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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 const int32_t kListLength = sizeof(kList) / sizeof(kList[0]); | 491 const int32_t kListLength = sizeof(kList) / sizeof(kList[0]); |
492 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpNack, kListLength, | 492 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpNack, kListLength, |
493 kList)); | 493 kList)); |
494 EXPECT_EQ(1, parser()->nack()->num_packets()); | 494 EXPECT_EQ(1, parser()->nack()->num_packets()); |
495 EXPECT_EQ(kSenderSsrc, parser()->nack()->sender_ssrc()); | 495 EXPECT_EQ(kSenderSsrc, parser()->nack()->sender_ssrc()); |
496 EXPECT_EQ(kRemoteSsrc, parser()->nack()->media_ssrc()); | 496 EXPECT_EQ(kRemoteSsrc, parser()->nack()->media_ssrc()); |
497 EXPECT_THAT(parser()->nack()->packet_ids(), ElementsAre(0, 1, 16)); | 497 EXPECT_THAT(parser()->nack()->packet_ids(), ElementsAre(0, 1, 16)); |
498 } | 498 } |
499 | 499 |
500 TEST_F(RtcpSenderTest, RembStatus) { | 500 TEST_F(RtcpSenderTest, RembStatus) { |
| 501 const uint64_t kBitrate = 261011; |
| 502 const std::vector<uint32_t> kSsrcs = {kRemoteSsrc, kRemoteSsrc + 1}; |
| 503 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize); |
| 504 |
501 EXPECT_FALSE(rtcp_sender_->REMB()); | 505 EXPECT_FALSE(rtcp_sender_->REMB()); |
| 506 rtcp_sender_->SendRTCP(feedback_state(), kRtcpRr); |
| 507 ASSERT_EQ(1, parser()->receiver_report()->num_packets()); |
| 508 EXPECT_EQ(0, parser()->remb()->num_packets()); |
| 509 |
502 rtcp_sender_->SetREMBStatus(true); | 510 rtcp_sender_->SetREMBStatus(true); |
503 EXPECT_TRUE(rtcp_sender_->REMB()); | 511 EXPECT_TRUE(rtcp_sender_->REMB()); |
| 512 rtcp_sender_->SetREMBData(kBitrate, kSsrcs); |
| 513 rtcp_sender_->SendRTCP(feedback_state(), kRtcpRr); |
| 514 ASSERT_EQ(2, parser()->receiver_report()->num_packets()); |
| 515 EXPECT_EQ(1, parser()->remb()->num_packets()); |
| 516 |
| 517 // Sending another report sends remb again, even if no new remb data was set. |
| 518 rtcp_sender_->SendRTCP(feedback_state(), kRtcpRr); |
| 519 ASSERT_EQ(3, parser()->receiver_report()->num_packets()); |
| 520 EXPECT_EQ(2, parser()->remb()->num_packets()); |
| 521 |
| 522 // Turn off remb. rtcp_sender no longer should send it. |
504 rtcp_sender_->SetREMBStatus(false); | 523 rtcp_sender_->SetREMBStatus(false); |
505 EXPECT_FALSE(rtcp_sender_->REMB()); | 524 EXPECT_FALSE(rtcp_sender_->REMB()); |
| 525 rtcp_sender_->SendRTCP(feedback_state(), kRtcpRr); |
| 526 ASSERT_EQ(4, parser()->receiver_report()->num_packets()); |
| 527 EXPECT_EQ(2, parser()->remb()->num_packets()); |
506 } | 528 } |
507 | 529 |
508 TEST_F(RtcpSenderTest, SendRemb) { | 530 TEST_F(RtcpSenderTest, SendRemb) { |
509 const uint64_t kBitrate = 261011; | 531 const uint64_t kBitrate = 261011; |
510 std::vector<uint32_t> ssrcs; | 532 std::vector<uint32_t> ssrcs; |
511 ssrcs.push_back(kRemoteSsrc); | 533 ssrcs.push_back(kRemoteSsrc); |
512 ssrcs.push_back(kRemoteSsrc + 1); | 534 ssrcs.push_back(kRemoteSsrc + 1); |
513 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize); | 535 rtcp_sender_->SetRTCPStatus(RtcpMode::kReducedSize); |
514 rtcp_sender_->SetREMBData(kBitrate, ssrcs); | 536 rtcp_sender_->SetREMBData(kBitrate, ssrcs); |
515 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpRemb)); | 537 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpRemb)); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 const rtcp::TargetBitrate::BitrateItem& item = bitrates[index]; | 836 const rtcp::TargetBitrate::BitrateItem& item = bitrates[index]; |
815 EXPECT_EQ(sl, item.spatial_layer); | 837 EXPECT_EQ(sl, item.spatial_layer); |
816 EXPECT_EQ(tl, item.temporal_layer); | 838 EXPECT_EQ(tl, item.temporal_layer); |
817 EXPECT_EQ(start_bitrate_bps + (tl * 20000), | 839 EXPECT_EQ(start_bitrate_bps + (tl * 20000), |
818 item.target_bitrate_kbps * 1000); | 840 item.target_bitrate_kbps * 1000); |
819 } | 841 } |
820 } | 842 } |
821 } | 843 } |
822 | 844 |
823 } // namespace webrtc | 845 } // namespace webrtc |
OLD | NEW |