def test_rtp_rtx(self): receiver = RTCRtpReceiver('video', self.local_transport) self.assertEqual(receiver.transport, self.local_transport) receiver._track = RemoteStreamTrack(kind='video') run( receiver.receive( RTCRtpReceiveParameters( codecs=[ VP8_CODEC, RTCRtpCodecParameters(mimeType='video/rtx', clockRate=90000, payloadType=101, parameters={'apt': 100}), ], encodings=[ RTCRtpEncodingParameters( ssrc=1234, payloadType=100, rtx=RTCRtpRtxParameters(ssrc=2345)) ]))) # receive RTX with payload packet = RtpPacket(payload_type=101, ssrc=2345, payload=b'\x00\x00') run(receiver._handle_rtp_packet(packet, arrival_time_ms=0)) # receive RTX without payload packet = RtpPacket(payload_type=101, ssrc=2345) run(receiver._handle_rtp_packet(packet, arrival_time_ms=0)) # shutdown run(receiver.stop())
async def test_rtp_rtx(self): async with create_receiver("video") as receiver: receiver._track = RemoteStreamTrack(kind="video") await receiver.receive( RTCRtpReceiveParameters( codecs=[ VP8_CODEC, RTCRtpCodecParameters( mimeType="video/rtx", clockRate=90000, payloadType=101, parameters={"apt": 100}, ), ], encodings=[ RTCRtpEncodingParameters( ssrc=1234, payloadType=100, rtx=RTCRtpRtxParameters(ssrc=2345), ) ], ) ) # receive RTX with payload packet = RtpPacket(payload_type=101, ssrc=2345, payload=b"\x00\x00") await receiver._handle_rtp_packet(packet, arrival_time_ms=0) # receive RTX without payload packet = RtpPacket(payload_type=101, ssrc=2345) await receiver._handle_rtp_packet(packet, arrival_time_ms=0)