Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc

Issue 1335353005: Remove channel ids from various interfaces. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 uint32_t ssrc_; 193 uint32_t ssrc_;
194 RtcpPacketTypeCounter counter_; 194 RtcpPacketTypeCounter counter_;
195 }; 195 };
196 196
197 class TestTransport : public Transport, 197 class TestTransport : public Transport,
198 public NullRtpData { 198 public NullRtpData {
199 public: 199 public:
200 TestTransport() {} 200 TestTransport() {}
201 201
202 int SendPacket(int /*ch*/, const void* /*data*/, size_t /*len*/) override { 202 int SendPacket(const void* /*data*/, size_t /*len*/) override {
203 return -1; 203 return -1;
204 } 204 }
205 int SendRTCPPacket(int /*ch*/, const void* data, size_t len) override { 205 int SendRTCPPacket(const void* data, size_t len) override {
206 parser_.Parse(static_cast<const uint8_t*>(data), len); 206 parser_.Parse(static_cast<const uint8_t*>(data), len);
207 return static_cast<int>(len); 207 return static_cast<int>(len);
208 } 208 }
209 int OnReceivedPayloadData(const uint8_t* payload_data, 209 int OnReceivedPayloadData(const uint8_t* payload_data,
210 const size_t payload_size, 210 const size_t payload_size,
211 const WebRtcRTPHeader* rtp_header) override { 211 const WebRtcRTPHeader* rtp_header) override {
212 return 0; 212 return 0;
213 } 213 }
214 test::RtcpPacketParser parser_; 214 test::RtcpPacketParser parser_;
215 }; 215 };
216 216
217 namespace { 217 namespace {
218 static const uint32_t kSenderSsrc = 0x11111111; 218 static const uint32_t kSenderSsrc = 0x11111111;
219 static const uint32_t kRemoteSsrc = 0x22222222; 219 static const uint32_t kRemoteSsrc = 0x22222222;
220 } 220 }
221 221
222 class RtcpSenderTest : public ::testing::Test { 222 class RtcpSenderTest : public ::testing::Test {
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.id = 0;
229 configuration.audio = false; 228 configuration.audio = false;
230 configuration.clock = &clock_; 229 configuration.clock = &clock_;
231 configuration.outgoing_transport = &test_transport_; 230 configuration.outgoing_transport = &test_transport_;
232 231
233 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration)); 232 rtp_rtcp_impl_.reset(new ModuleRtpRtcpImpl(configuration));
234 rtcp_sender_.reset(new RTCPSender(configuration.id, false, &clock_, 233 rtcp_sender_.reset(
235 receive_statistics_.get(), nullptr)); 234 new RTCPSender(false, &clock_, receive_statistics_.get(), nullptr));
236 rtcp_sender_->SetSSRC(kSenderSsrc); 235 rtcp_sender_->SetSSRC(kSenderSsrc);
237 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 236 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
238 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_)); 237 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_));
239 } 238 }
240 239
241 void InsertIncomingPacket(uint32_t remote_ssrc, uint16_t seq_num) { 240 void InsertIncomingPacket(uint32_t remote_ssrc, uint16_t seq_num) {
242 RTPHeader header; 241 RTPHeader header;
243 header.ssrc = remote_ssrc; 242 header.ssrc = remote_ssrc;
244 header.sequenceNumber = seq_num; 243 header.sequenceNumber = seq_num;
245 header.timestamp = 12345; 244 header.timestamp = 12345;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 EXPECT_EQ(clock_.CurrentNtpInMilliseconds(), time_ms); 661 EXPECT_EQ(clock_.CurrentNtpInMilliseconds(), time_ms);
663 clock_.AdvanceTimeMilliseconds(1000); 662 clock_.AdvanceTimeMilliseconds(1000);
664 } 663 }
665 // The first report should no longer be stored. 664 // The first report should no longer be stored.
666 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms)); 665 EXPECT_FALSE(rtcp_sender_->SendTimeOfXrRrReport(initial_mid_ntp, &time_ms));
667 } 666 }
668 667
669 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) { 668 TEST_F(RtcpSenderTest, TestRegisterRtcpPacketTypeObserver) {
670 RtcpPacketTypeCounterObserverImpl observer; 669 RtcpPacketTypeCounterObserverImpl observer;
671 rtcp_sender_.reset( 670 rtcp_sender_.reset(
672 new RTCPSender(0, false, &clock_, receive_statistics_.get(), &observer)); 671 new RTCPSender(false, &clock_, receive_statistics_.get(), &observer));
673 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc); 672 rtcp_sender_->SetRemoteSSRC(kRemoteSsrc);
674 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_)); 673 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(&test_transport_));
675 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound); 674 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound);
676 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli)); 675 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpPli));
677 EXPECT_EQ(1, parser()->pli()->num_packets()); 676 EXPECT_EQ(1, parser()->pli()->num_packets());
678 EXPECT_EQ(kRemoteSsrc, observer.ssrc_); 677 EXPECT_EQ(kRemoteSsrc, observer.ssrc_);
679 EXPECT_EQ(1U, observer.counter_.pli_packets); 678 EXPECT_EQ(1U, observer.counter_.pli_packets);
680 EXPECT_EQ(clock_.TimeInMilliseconds(), 679 EXPECT_EQ(clock_.TimeInMilliseconds(),
681 observer.counter_.first_packet_time_ms); 680 observer.counter_.first_packet_time_ms);
682 } 681 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 rtcp_sender_->SetREMBData(kBitrate, ssrcs); 755 rtcp_sender_->SetREMBData(kBitrate, ssrcs);
757 std::set<RTCPPacketType> packet_types; 756 std::set<RTCPPacketType> packet_types;
758 packet_types.insert(kRtcpRemb); 757 packet_types.insert(kRtcpRemb);
759 packet_types.insert(kRtcpPli); 758 packet_types.insert(kRtcpPli);
760 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); 759 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types));
761 EXPECT_EQ(1, parser()->remb_item()->num_packets()); 760 EXPECT_EQ(1, parser()->remb_item()->num_packets());
762 EXPECT_EQ(1, parser()->pli()->num_packets()); 761 EXPECT_EQ(1, parser()->pli()->num_packets());
763 } 762 }
764 763
765 } // namespace webrtc 764 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.cc ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_audio.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698