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

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

Issue 1208843003: Removed extended jitter report from RtcpSender (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Removed extended jitter support for outgoing Rtcp Created 5 years, 5 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 12 matching lines...) Expand all
23 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h" 23 #include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
24 #include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h" 24 #include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h"
25 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" 25 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h"
26 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" 26 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h"
27 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h" 27 #include "webrtc/modules/rtp_rtcp/source/rtp_receiver_video.h"
28 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" 28 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h"
29 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" 29 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h"
30 30
31 namespace webrtc { 31 namespace webrtc {
32 32
33 namespace {
34
33 TEST(NACKStringBuilderTest, TestCase1) { 35 TEST(NACKStringBuilderTest, TestCase1) {
34 NACKStringBuilder builder; 36 NACKStringBuilder builder;
35 builder.PushNACK(5); 37 builder.PushNACK(5);
36 builder.PushNACK(7); 38 builder.PushNACK(7);
37 builder.PushNACK(9); 39 builder.PushNACK(9);
38 builder.PushNACK(10); 40 builder.PushNACK(10);
39 builder.PushNACK(11); 41 builder.PushNACK(11);
40 builder.PushNACK(12); 42 builder.PushNACK(12);
41 builder.PushNACK(15); 43 builder.PushNACK(15);
42 builder.PushNACK(18); 44 builder.PushNACK(18);
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 267
266 int OnReceivedPayloadData(const uint8_t* payloadData, 268 int OnReceivedPayloadData(const uint8_t* payloadData,
267 const size_t payloadSize, 269 const size_t payloadSize,
268 const WebRtcRTPHeader* rtpHeader) override { 270 const WebRtcRTPHeader* rtpHeader) override {
269 return 0; 271 return 0;
270 } 272 }
271 RTCPReceiver* rtcp_receiver_; 273 RTCPReceiver* rtcp_receiver_;
272 RTCPHelp::RTCPPacketInformation rtcp_packet_info_; 274 RTCPHelp::RTCPPacketInformation rtcp_packet_info_;
273 }; 275 };
274 276
277 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
278 static const int kMaxPacketLength = 1500;
279 static const uint32_t kMediaSsrc = 0x11111111;
280
275 class RtcpSenderTest : public ::testing::Test { 281 class RtcpSenderTest : public ::testing::Test {
276 protected: 282 protected:
277 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000;
278
279 RtcpSenderTest() 283 RtcpSenderTest()
280 : over_use_detector_options_(), 284 : over_use_detector_options_(),
281 clock_(1335900000), 285 clock_(1335900000),
282 rtp_payload_registry_(new RTPPayloadRegistry( 286 rtp_payload_registry_(new RTPPayloadRegistry(
283 RTPPayloadStrategy::CreateStrategy(false))), 287 RTPPayloadStrategy::CreateStrategy(false))),
284 remote_bitrate_observer_(), 288 remote_bitrate_observer_(),
285 remote_bitrate_estimator_( 289 remote_bitrate_estimator_(
286 RemoteBitrateEstimatorFactory().Create( 290 RemoteBitrateEstimatorFactory().Create(
287 &remote_bitrate_observer_, 291 &remote_bitrate_observer_,
288 &clock_, 292 &clock_,
289 kMimdControl, 293 kMimdControl,
290 kRemoteBitrateEstimatorMinBitrateBps)), 294 kRemoteBitrateEstimatorMinBitrateBps)),
291 receive_statistics_(ReceiveStatistics::Create(&clock_)) { 295 receive_statistics_(ReceiveStatistics::Create(&clock_)) {
292 test_transport_ = new TestTransport(); 296 test_transport_ = new TestTransport();
293 297
294 RtpRtcp::Configuration configuration; 298 RtpRtcp::Configuration configuration;
295 configuration.id = 0; 299 configuration.id = 0;
296 configuration.audio = false; 300 configuration.audio = false;
297 configuration.clock = &clock_; 301 configuration.clock = &clock_;
298 configuration.outgoing_transport = test_transport_; 302 configuration.outgoing_transport = test_transport_;
299 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); 303 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get();
300 304
301 rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); 305 rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
302 rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver( 306 rtp_receiver_.reset(RtpReceiver::CreateVideoReceiver(
303 0, &clock_, test_transport_, NULL, rtp_payload_registry_.get())); 307 0, &clock_, test_transport_, NULL, rtp_payload_registry_.get()));
304 rtcp_sender_ = 308 rtcp_sender_ =
305 new RTCPSender(0, false, &clock_, receive_statistics_.get(), NULL); 309 new RTCPSender(0, false, &clock_, receive_statistics_.get(), NULL);
306 rtcp_receiver_ = 310 rtcp_receiver_ =
307 new RTCPReceiver(0, &clock_, false, NULL, NULL, NULL, rtp_rtcp_impl_); 311 new RTCPReceiver(0, &clock_, false, NULL, NULL, NULL, rtp_rtcp_impl_);
312 std::set<uint32_t> registered_ssrcs;
313 registered_ssrcs.insert(kMediaSsrc);
åsapersson 2015/07/22 05:58:27 The main_ssrc should also be in the set right? And
sprang_webrtc 2015/07/23 13:50:40 I find these settings a bit confusing. Did I get i
314 rtcp_receiver_->SetSsrcs(0, registered_ssrcs);
308 test_transport_->SetRTCPReceiver(rtcp_receiver_); 315 test_transport_->SetRTCPReceiver(rtcp_receiver_);
309 // Initialize 316 // Initialize
310 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_)); 317 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_));
311 } 318 }
319
312 ~RtcpSenderTest() { 320 ~RtcpSenderTest() {
313 delete rtcp_sender_; 321 delete rtcp_sender_;
314 delete rtcp_receiver_; 322 delete rtcp_receiver_;
315 delete rtp_rtcp_impl_; 323 delete rtp_rtcp_impl_;
316 delete test_transport_; 324 delete test_transport_;
317 } 325 }
318 326
319 // Helper function: Incoming RTCP has a specific packet type. 327 // Helper function: Incoming RTCP has a specific packet type.
320 bool gotPacketType(RTCPPacketType packet_type) { 328 bool gotPacketType(RTCPPacketType packet_type) {
321 return ((test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags) & 329 return ((test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags) &
322 packet_type) != 0U; 330 packet_type) != 0U;
323 } 331 }
324 332
325 OverUseDetectorOptions over_use_detector_options_; 333 OverUseDetectorOptions over_use_detector_options_;
326 SimulatedClock clock_; 334 SimulatedClock clock_;
327 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; 335 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
328 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; 336 rtc::scoped_ptr<RtpReceiver> rtp_receiver_;
329 ModuleRtpRtcpImpl* rtp_rtcp_impl_; 337 ModuleRtpRtcpImpl* rtp_rtcp_impl_;
330 RTCPSender* rtcp_sender_; 338 RTCPSender* rtcp_sender_;
331 RTCPReceiver* rtcp_receiver_; 339 RTCPReceiver* rtcp_receiver_;
332 TestTransport* test_transport_; 340 TestTransport* test_transport_;
333 MockRemoteBitrateObserver remote_bitrate_observer_; 341 MockRemoteBitrateObserver remote_bitrate_observer_;
334 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; 342 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_;
335 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; 343 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_;
336 344
337 enum {kMaxPacketLength = 1500};
338 uint8_t packet_[kMaxPacketLength]; 345 uint8_t packet_[kMaxPacketLength];
339 }; 346 };
340 347
341 TEST_F(RtcpSenderTest, RtcpOff) { 348 TEST_F(RtcpSenderTest, RtcpOff) {
342 rtcp_sender_->SetRTCPStatus(kRtcpOff); 349 rtcp_sender_->SetRTCPStatus(kRtcpOff);
343 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); 350 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState();
344 EXPECT_EQ(-1, rtcp_sender_->SendRTCP(feedback_state, kRtcpSr)); 351 EXPECT_EQ(-1, rtcp_sender_->SendRTCP(feedback_state, kRtcpSr));
345 } 352 }
346 353
347 TEST_F(RtcpSenderTest, IJStatus) {
348 ASSERT_FALSE(rtcp_sender_->IJ());
349 rtcp_sender_->SetIJStatus(true);
350 EXPECT_TRUE(rtcp_sender_->IJ());
351 }
352
353 TEST_F(RtcpSenderTest, TestCompound) { 354 TEST_F(RtcpSenderTest, TestCompound) {
354 const bool marker_bit = false; 355 const bool marker_bit = false;
355 const uint8_t payload_type = 100; 356 const uint8_t payload_type = 100;
356 const uint16_t seq_num = 11111; 357 const uint16_t seq_num = 11111;
357 const uint32_t timestamp = 1234567; 358 const uint32_t timestamp = 1234567;
358 const uint32_t ssrc = 0x11111111;
359 size_t packet_length = 0; 359 size_t packet_length = 0;
360 CreateRtpPacket(marker_bit, payload_type, seq_num, timestamp, ssrc, packet_, 360 CreateRtpPacket(marker_bit, payload_type, seq_num, timestamp, kMediaSsrc,
361 &packet_length); 361 packet_, &packet_length);
362 EXPECT_EQ(25u, packet_length); 362 EXPECT_EQ(25u, packet_length);
363 363
364 VideoCodec codec_inst; 364 VideoCodec codec_inst;
365 strncpy(codec_inst.plName, "VP8", webrtc::kPayloadNameSize - 1); 365 strncpy(codec_inst.plName, "VP8", webrtc::kPayloadNameSize - 1);
366 codec_inst.codecType = webrtc::kVideoCodecVP8; 366 codec_inst.codecType = webrtc::kVideoCodecVP8;
367 codec_inst.plType = payload_type; 367 codec_inst.plType = payload_type;
368 EXPECT_EQ(0, rtp_receiver_->RegisterReceivePayload(codec_inst.plName, 368 EXPECT_EQ(0, rtp_receiver_->RegisterReceivePayload(codec_inst.plName,
369 codec_inst.plType, 369 codec_inst.plType,
370 90000, 370 90000,
371 0, 371 0,
372 codec_inst.maxBitrate)); 372 codec_inst.maxBitrate));
373 373
374 // Make sure RTP packet has been received. 374 // Make sure RTP packet has been received.
375 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); 375 rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
376 RTPHeader header; 376 RTPHeader header;
377 EXPECT_TRUE(parser->Parse(packet_, packet_length, &header)); 377 EXPECT_TRUE(parser->Parse(packet_, packet_length, &header));
378 PayloadUnion payload_specific; 378 PayloadUnion payload_specific;
379 EXPECT_TRUE(rtp_payload_registry_->GetPayloadSpecifics(header.payloadType, 379 EXPECT_TRUE(rtp_payload_registry_->GetPayloadSpecifics(header.payloadType,
380 &payload_specific)); 380 &payload_specific));
381 receive_statistics_->IncomingPacket(header, packet_length, false); 381 receive_statistics_->IncomingPacket(header, packet_length, false);
382 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, packet_, packet_length, 382 EXPECT_TRUE(rtp_receiver_->IncomingRtpPacket(header, packet_, packet_length,
383 payload_specific, true)); 383 payload_specific, true));
384 384
385 rtcp_sender_->SetIJStatus(true); 385 rtcp_sender_->SetCNAME("Foo");
386 rtcp_sender_->SetRTCPStatus(kRtcpCompound); 386 rtcp_sender_->SetRTCPStatus(kRtcpCompound);
387 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); 387 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState();
388 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr)); 388 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr));
389 389
390 // Transmission time offset packet should be received. 390 // Sdes packet should be received, along with report blocks.
391 ASSERT_TRUE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags & 391 ASSERT_TRUE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags &
392 kRtcpTransmissionTimeOffset); 392 kRtcpSdes);
393 EXPECT_GT(test_transport_->rtcp_packet_info_.report_blocks.size(), 0u);
393 } 394 }
394 395
395 TEST_F(RtcpSenderTest, TestCompound_NoRtpReceived) { 396 TEST_F(RtcpSenderTest, TestCompound_NoRtpReceived) {
396 rtcp_sender_->SetIJStatus(true); 397 rtcp_sender_->SetCNAME("Foo");
397 rtcp_sender_->SetRTCPStatus(kRtcpCompound); 398 rtcp_sender_->SetRTCPStatus(kRtcpCompound);
398 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); 399 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState();
399 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr)); 400 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRr));
400 401
401 // Transmission time offset packet should not be received. 402 // Sdes should be received, but no report blocks.
402 ASSERT_FALSE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags & 403 ASSERT_TRUE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags &
403 kRtcpTransmissionTimeOffset); 404 kRtcpSdes);
405 EXPECT_EQ(0u, test_transport_->rtcp_packet_info_.report_blocks.size());
404 } 406 }
405 407
406 TEST_F(RtcpSenderTest, TestXrReceiverReferenceTime) { 408 TEST_F(RtcpSenderTest, TestXrReceiverReferenceTime) {
407 rtcp_sender_->SetRTCPStatus(kRtcpCompound); 409 rtcp_sender_->SetRTCPStatus(kRtcpCompound);
408 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState(); 410 RTCPSender::FeedbackState feedback_state = rtp_rtcp_impl_->GetFeedbackState();
409 EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false)); 411 EXPECT_EQ(0, rtcp_sender_->SetSendingStatus(feedback_state, false));
410 rtcp_sender_->SendRtcpXrReceiverReferenceTime(true); 412 rtcp_sender_->SendRtcpXrReceiverReferenceTime(true);
411 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpReport)); 413 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpReport));
412 414
413 EXPECT_TRUE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags & 415 EXPECT_TRUE(test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags &
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // test_transport_. 509 // test_transport_.
508 ASSERT_NE(0U, test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags); 510 ASSERT_NE(0U, test_transport_->rtcp_packet_info_.rtcpPacketTypeFlags);
509 EXPECT_TRUE(gotPacketType(kRtcpTmmbn)); 511 EXPECT_TRUE(gotPacketType(kRtcpTmmbn));
510 TMMBRSet incoming_set; 512 TMMBRSet incoming_set;
511 bool owner = false; 513 bool owner = false;
512 // We expect 1 member of the incoming set. 514 // We expect 1 member of the incoming set.
513 EXPECT_EQ(1, test_transport_->rtcp_receiver_->BoundingSet(owner, 515 EXPECT_EQ(1, test_transport_->rtcp_receiver_->BoundingSet(owner,
514 &incoming_set)); 516 &incoming_set));
515 EXPECT_EQ(kSourceSsrc, incoming_set.Ssrc(0)); 517 EXPECT_EQ(kSourceSsrc, incoming_set.Ssrc(0));
516 } 518 }
519
520 } // namespace
517 } // namespace webrtc 521 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698