OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 length == header.headerLength + header.paddingLength); | 729 length == header.headerLength + header.paddingLength); |
730 return SEND_PACKET; | 730 return SEND_PACKET; |
731 } | 731 } |
732 if (header.timestamp == retransmitted_timestamp_) { | 732 if (header.timestamp == retransmitted_timestamp_) { |
733 EXPECT_EQ(retransmission_ssrc_, header.ssrc); | 733 EXPECT_EQ(retransmission_ssrc_, header.ssrc); |
734 EXPECT_EQ(retransmission_payload_type_, header.payloadType); | 734 EXPECT_EQ(retransmission_payload_type_, header.payloadType); |
735 frame_retransmitted_ = true; | 735 frame_retransmitted_ = true; |
736 return SEND_PACKET; | 736 return SEND_PACKET; |
737 } | 737 } |
738 | 738 |
739 EXPECT_EQ(kVideoSendSsrcs[0], header.ssrc); | 739 EXPECT_EQ(kVideoSendSsrcs[0], header.ssrc) |
| 740 << "Payload type " << static_cast<int>(header.payloadType) |
| 741 << " not expected."; |
740 EXPECT_EQ(payload_type_, header.payloadType); | 742 EXPECT_EQ(payload_type_, header.payloadType); |
741 | 743 |
742 // Found the final packet of the frame to inflict loss to, drop this and | 744 // Found the final packet of the frame to inflict loss to, drop this and |
743 // expect a retransmission. | 745 // expect a retransmission. |
744 if (header.markerBit && ++marker_bits_observed_ == kDroppedFrameNumber) { | 746 if (header.markerBit && ++marker_bits_observed_ == kDroppedFrameNumber) { |
745 retransmitted_timestamp_ = header.timestamp; | 747 retransmitted_timestamp_ = header.timestamp; |
746 return DROP_PACKET; | 748 return DROP_PACKET; |
747 } | 749 } |
748 | 750 |
749 return SEND_PACKET; | 751 return SEND_PACKET; |
(...skipping 11 matching lines...) Expand all Loading... |
761 VideoSendStream::Config* send_config, | 763 VideoSendStream::Config* send_config, |
762 std::vector<VideoReceiveStream::Config>* receive_configs, | 764 std::vector<VideoReceiveStream::Config>* receive_configs, |
763 VideoEncoderConfig* encoder_config) override { | 765 VideoEncoderConfig* encoder_config) override { |
764 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 766 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
765 (*receive_configs)[0].pre_render_callback = this; | 767 (*receive_configs)[0].pre_render_callback = this; |
766 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 768 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
767 | 769 |
768 if (payload_type_ == kRedPayloadType) { | 770 if (payload_type_ == kRedPayloadType) { |
769 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 771 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; |
770 send_config->rtp.fec.red_payload_type = kRedPayloadType; | 772 send_config->rtp.fec.red_payload_type = kRedPayloadType; |
771 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; | 773 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) |
772 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; | 774 send_config->rtp.fec.red_rtx_payload_type = kRtxRedPayloadType; |
| 775 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = |
| 776 send_config->rtp.fec.ulpfec_payload_type; |
| 777 (*receive_configs)[0].rtp.fec.red_payload_type = |
| 778 send_config->rtp.fec.red_payload_type; |
| 779 (*receive_configs)[0].rtp.fec.red_rtx_payload_type = |
| 780 send_config->rtp.fec.red_rtx_payload_type; |
773 } | 781 } |
774 | 782 |
775 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) { | 783 if (retransmission_ssrc_ == kSendRtxSsrcs[0]) { |
776 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); | 784 send_config->rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); |
777 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; | 785 send_config->rtp.rtx.payload_type = kSendRtxPayloadType; |
778 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].ssrc = | 786 (*receive_configs)[0].rtp.rtx[payload_type_].ssrc = kSendRtxSsrcs[0]; |
779 kSendRtxSsrcs[0]; | 787 (*receive_configs)[0].rtp.rtx[payload_type_].payload_type = |
780 (*receive_configs)[0].rtp.rtx[kFakeVideoSendPayloadType].payload_type = | |
781 kSendRtxPayloadType; | 788 kSendRtxPayloadType; |
782 } | 789 } |
783 } | 790 } |
784 | 791 |
785 void PerformTest() override { | 792 void PerformTest() override { |
786 EXPECT_TRUE(Wait()) | 793 EXPECT_TRUE(Wait()) |
787 << "Timed out while waiting for retransmission to render."; | 794 << "Timed out while waiting for retransmission to render."; |
788 } | 795 } |
789 | 796 |
790 int GetPayloadType(bool use_rtx, bool use_red) { | 797 int GetPayloadType(bool use_rtx, bool use_red) { |
791 return use_rtx ? kSendRtxPayloadType | 798 if (use_red) { |
792 : (use_red ? kRedPayloadType : kFakeVideoSendPayloadType); | 799 if (use_rtx) |
| 800 return kRtxRedPayloadType; |
| 801 return kRedPayloadType; |
| 802 } |
| 803 if (use_rtx) |
| 804 return kSendRtxPayloadType; |
| 805 return kFakeVideoSendPayloadType; |
793 } | 806 } |
794 | 807 |
795 rtc::CriticalSection crit_; | 808 rtc::CriticalSection crit_; |
796 const int payload_type_; | 809 const int payload_type_; |
797 const uint32_t retransmission_ssrc_; | 810 const uint32_t retransmission_ssrc_; |
798 const int retransmission_payload_type_; | 811 const int retransmission_payload_type_; |
799 int marker_bits_observed_; | 812 int marker_bits_observed_; |
800 int num_packets_observed_; | 813 int num_packets_observed_; |
801 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); | 814 uint32_t retransmitted_timestamp_ GUARDED_BY(&crit_); |
802 bool frame_retransmitted_; | 815 bool frame_retransmitted_; |
(...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 private: | 3512 private: |
3500 bool video_observed_; | 3513 bool video_observed_; |
3501 bool audio_observed_; | 3514 bool audio_observed_; |
3502 SequenceNumberUnwrapper unwrapper_; | 3515 SequenceNumberUnwrapper unwrapper_; |
3503 std::set<int64_t> received_packet_ids_; | 3516 std::set<int64_t> received_packet_ids_; |
3504 } test; | 3517 } test; |
3505 | 3518 |
3506 RunBaseTest(&test); | 3519 RunBaseTest(&test); |
3507 } | 3520 } |
3508 } // namespace webrtc | 3521 } // namespace webrtc |
OLD | NEW |