OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 protected: | 223 protected: |
224 RtcpSenderTest() | 224 RtcpSenderTest() |
225 : clock_(1335900000), | 225 : clock_(1335900000), |
226 receive_statistics_(ReceiveStatistics::Create(&clock_)) { | 226 receive_statistics_(ReceiveStatistics::Create(&clock_)) { |
227 RtpRtcp::Configuration configuration; | 227 RtpRtcp::Configuration configuration; |
228 configuration.audio = false; | 228 configuration.audio = false; |
229 configuration.clock = &clock_; | 229 configuration.clock = &clock_; |
230 configuration.outgoing_transport = &test_transport_; | 230 configuration.outgoing_transport = &test_transport_; |
231 | 231 |
232 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration)); | 232 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration)); |
233 rtcp_sender_.reset( | 233 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(), |
234 new RTCPSender(false, &clock_, receive_statistics_.get(), nullptr)); | 234 nullptr, &test_transport_)); |
235 rtcp_sender_->SetSSRC(kSenderSsrc); | 235 rtcp_sender_->SetSSRC(kSenderSsrc); |
236 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); | 236 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); |
237 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_)); | |
238 } | 237 } |
239 | 238 |
240 void InsertIncomingPacket(uint32_t remote_ssrc, uint16_t seq_num) { | 239 void InsertIncomingPacket(uint32_t remote_ssrc, uint16_t seq_num) { |
241 RTPHeader header; | 240 RTPHeader header; |
242 header.ssrc = remote_ssrc; | 241 header.ssrc = remote_ssrc; |
243 header.sequenceNumber = seq_num; | 242 header.sequenceNumber = seq_num; |
244 header.timestamp = 12345; | 243 header.timestamp = 12345; |
245 header.headerLength = 12; | 244 header.headerLength = 12; |
246 size_t kPacketLength = 100; | 245 size_t kPacketLength = 100; |
247 receive_statistics_->IncomingPacket(header, kPacketLength, false); | 246 receive_statistics_->IncomingPacket(header, kPacketLength, false); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 EXPECT_TRUE(rtcp_sender_->SendTimeOfXrRrReport(mid_ntp, &time_ms)); | 659 EXPECT_TRUE(rtcp_sender_->SendTimeOfXrRrReport(mid_ntp, &time_ms)); |
661 EXPECT_EQ(clock_.CurrentNtpInMilliseconds(), time_ms); | 660 EXPECT_EQ(clock_.CurrentNtpInMilliseconds(), time_ms); |
662 clock_.AdvanceTimeMilliseconds(1000); | 661 clock_.AdvanceTimeMilliseconds(1000); |
663 } | 662 } |
664 // The first report should no longer be stored. | 663 // The first report should no longer be stored. |
665 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms)); | 664 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms)); |
666 } | 665 } |
667 | 666 |
668 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) { | 667 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) { |
669 RtcpPacketTypeCounterObserverImpl observer; | 668 RtcpPacketTypeCounterObserverImpl observer; |
670 rtcp_sender_.reset( | 669 rtcp_sender_.reset(new RTCPSender(false, &clock_, receive_statistics_.get(), |
671 new RTCPSender(false, &clock_, receive_statistics_.get(), &observer)); | 670 &observer, &test_transport_)); |
672 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); | 671 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); |
673 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_)); | |
674 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound); | 672 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound); |
675 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli)); | 673 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli)); |
676 EXPECT_EQ(1, parser()->pli()->num_packets()); | 674 EXPECT_EQ(1, parser()->pli()->num_packets()); |
677 EXPECT_EQ(kRemoteSsrc, observer.ssrc_); | 675 EXPECT_EQ(kRemoteSsrc, observer.ssrc_); |
678 EXPECT_EQ(1U, observer.counter_.pli_packets); | 676 EXPECT_EQ(1U, observer.counter_.pli_packets); |
679 EXPECT_EQ(clock_.TimeInMilliseconds(), | 677 EXPECT_EQ(clock_.TimeInMilliseconds(), |
680 observer.counter_.first_packet_time_ms); | 678 observer.counter_.first_packet_time_ms); |
681 } | 679 } |
682 | 680 |
683 TEST_F(RtcpSenderTest, SendTmmbr) { | 681 TEST_F(RtcpSenderTest, SendTmmbr) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 rtcp_sender_->SetREMBData(kBitrate, ssrcs); | 753 rtcp_sender_->SetREMBData(kBitrate, ssrcs); |
756 std::set<RTCPPacketType> packet_types; | 754 std::set<RTCPPacketType> packet_types; |
757 packet_types.insert(kRtcpRemb); | 755 packet_types.insert(kRtcpRemb); |
758 packet_types.insert(kRtcpPli); | 756 packet_types.insert(kRtcpPli); |
759 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); | 757 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); |
760 EXPECT_EQ(1, parser()->remb_item()->num_packets()); | 758 EXPECT_EQ(1, parser()->remb_item()->num_packets()); |
761 EXPECT_EQ(1, parser()->pli()->num_packets()); | 759 EXPECT_EQ(1, parser()->pli()->num_packets()); |
762 } | 760 } |
763 | 761 |
764 } // namespace webrtc | 762 } // namespace webrtc |
OLD | NEW |