or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aiortc@1.13.x
tile.json

tessl/pypi-aiortc

tessl install tessl/pypi-aiortc@1.13.0

Python implementation of WebRTC and ORTC for real-time peer-to-peer communication

Agent Success

Agent success rate when using this tile

87%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.02x

Baseline

Agent success rate without this tile

85%

task.mdevals/scenario-2/

Audio Stream Transmitter

Build a system that transmits audio data over RTP using WebRTC peer-to-peer connections with capability to monitor transmission statistics and dynamically replace audio sources.

Requirements

Your implementation should:

  1. Establish a peer connection capable of sending audio streams
  2. Create and transmit an audio track through the peer connection
  3. Replace the audio track dynamically with a different audio source without renegotiating the connection
  4. Retrieve transmission statistics including packets sent and bytes transmitted
  5. Query supported audio capabilities to verify codec support before transmission

Functional Requirements

Connection Setup

  • Initialize a peer connection configured for audio transmission
  • Create an SDP offer and set it as the local description
  • Handle the connection lifecycle appropriately

Audio Track Transmission

  • Start transmitting an audio track through the connection
  • Ensure the track is properly associated with the sender

Dynamic Track Replacement

  • Implement functionality to replace the currently transmitting audio track with a new audio source
  • The replacement should occur without requiring SDP renegotiation

Statistics Monitoring

  • Query and extract transmission statistics from the sender
  • Report at minimum: number of packets sent and total bytes transmitted

Capability Querying

  • Check what audio codecs and capabilities are supported before starting transmission

Test Cases

  • Given a peer connection with an audio track, when the connection is established, then the sender should be transmitting audio data @test
  • Given an active audio sender, when calling replace functionality with a new audio track, then the sender should switch to transmitting the new track @test
  • Given an active audio sender, when querying statistics, then it should return outbound RTP stream statistics with packet and byte counts @test
  • Given a request for audio capabilities, when querying sender capabilities, then it should return a list of supported audio codecs @test

Implementation

@generates

API

from aiortc import RTCPeerConnection, AudioStreamTrack, RTCConfiguration

class AudioTransmitter:
    """Manages audio transmission over WebRTC RTP."""

    def __init__(self, config: RTCConfiguration = None):
        """Initialize the audio transmitter with optional configuration."""
        pass

    async def start_transmission(self, audio_track: AudioStreamTrack):
        """
        Start transmitting an audio track.

        Parameters:
        - audio_track: The audio track to transmit
        """
        pass

    async def replace_audio_source(self, new_track: AudioStreamTrack):
        """
        Replace the current audio track with a new one without renegotiation.

        Parameters:
        - new_track: The new audio track to transmit
        """
        pass

    async def get_transmission_stats(self) -> dict:
        """
        Get current transmission statistics.

        Returns:
        dict with keys:
        - packets_sent (int): Number of RTP packets sent
        - bytes_sent (int): Total bytes transmitted
        """
        pass

    def get_supported_audio_codecs(self) -> list:
        """
        Get list of supported audio codec names.

        Returns:
        list of str: Codec names (e.g., ["opus", "PCMU", "PCMA"])
        """
        pass

    async def close(self):
        """Close the connection and clean up resources."""
        pass

Dependencies { .dependencies }

aiortc { .dependency }

Provides WebRTC implementation including RTCPeerConnection and RTP sender capabilities.

@satisfied-by