def test_route_rtcp(self): receiver = object() sender = object() router = RtpRouter() router.register_receiver(receiver, ssrcs=[1234, 2345], payload_types=[96, 97]) router.register_sender(sender, ssrc=3456) # BYE packet = RtcpByePacket(sources=[1234, 2345]) self.assertEqual(router.route_rtcp(packet), set([receiver])) # RR packet = RtcpRrPacket(ssrc=1234, reports=[ RtcpReceiverInfo(ssrc=3456, fraction_lost=0, packets_lost=0, highest_sequence=630, jitter=1906, lsr=0, dlsr=0) ]) self.assertEqual(router.route_rtcp(packet), set([sender])) # SR packet = RtcpSrPacket(ssrc=1234, sender_info=RtcpSenderInfo(ntp_timestamp=0, rtp_timestamp=0, packet_count=0, octet_count=0), reports=[ RtcpReceiverInfo(ssrc=3456, fraction_lost=0, packets_lost=0, highest_sequence=630, jitter=1906, lsr=0, dlsr=0) ]) self.assertEqual(router.route_rtcp(packet), set([receiver, sender])) # PSFB packet = RtcpPsfbPacket(fmt=RTCP_PSFB_PLI, ssrc=1234, media_ssrc=3456) self.assertEqual(router.route_rtcp(packet), set([sender])) # RTPFB packet = RtcpRtpfbPacket(fmt=RTCP_RTPFB_NACK, ssrc=1234, media_ssrc=3456) self.assertEqual(router.route_rtcp(packet), set([sender]))
def test_handle_rtcp_nack(self): sender = RTCRtpSender(VideoStreamTrack(), self.local_transport) self.assertEqual(sender.kind, 'video') run(sender.send(RTCRtpParameters(codecs=[VP8_CODEC]))) # receive RTCP feedback NACK packet = RtcpRtpfbPacket(fmt=RTCP_RTPFB_NACK, ssrc=1234, media_ssrc=sender._ssrc) packet.lost.append(7654) run(sender._handle_rtcp_packet(packet)) # clean shutdown run(sender.stop())
async def test_handle_rtcp_nack(self): async with dummy_dtls_transport_pair() as (local_transport, _): sender = RTCRtpSender(VideoStreamTrack(), local_transport) self.assertEqual(sender.kind, "video") await sender.send(RTCRtpParameters(codecs=[VP8_CODEC])) # receive RTCP feedback NACK packet = RtcpRtpfbPacket(fmt=RTCP_RTPFB_NACK, ssrc=1234, media_ssrc=sender._ssrc) packet.lost.append(7654) await sender._handle_rtcp_packet(packet) # clean shutdown await sender.stop()
def test_handle_rtcp_nack(self): transport, remote = dummy_dtls_transport_pair() sender = RTCRtpSender(VideoStreamTrack(), transport) self.assertEqual(sender.kind, 'video') self.assertEqual(sender.transport, transport) run(sender.send(RTCRtpParameters(codecs=[ RTCRtpCodecParameters(name='VP8', clockRate=90000, payloadType=100), ]))) # receive RTCP feedback NACK packet = RtcpRtpfbPacket(fmt=RTCP_RTPFB_NACK, ssrc=1234, media_ssrc=5678) packet.lost.append(7654) run(sender._handle_rtcp_packet(packet)) # clean shutdown run(sender.stop())