| 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 |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 #include "webrtc/common_types.h" | 13 #include "webrtc/common_types.h" |
| 14 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" | 14 #include "webrtc/modules/remote_bitrate_estimator/include/bwe_defines.h" |
| 15 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" | 15 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra
te_observer.h" |
| 16 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" | 16 #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_singl
e_stream.h" |
| 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" | 17 #include "webrtc/modules/rtp_rtcp/source/rtcp_receiver.h" |
| 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" | 18 #include "webrtc/modules/rtp_rtcp/source/rtcp_sender.h" |
| 19 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" | 19 #include "webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h" |
| 20 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" | 20 #include "webrtc/modules/rtp_rtcp/source/rtp_utility.h" |
| 21 #include "webrtc/test/null_transport.h" | 21 #include "webrtc/test/null_transport.h" |
| 22 #include "webrtc/typedefs.h" | 22 #include "webrtc/typedefs.h" |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 using namespace webrtc; | 26 using namespace webrtc; |
| 27 | 27 |
| 28 | |
| 29 class TestTransport : public Transport { | 28 class TestTransport : public Transport { |
| 30 public: | 29 public: |
| 31 TestTransport(RTCPReceiver* rtcp_receiver) : | 30 TestTransport(RTCPReceiver* rtcp_receiver) : rtcp_receiver_(rtcp_receiver) {} |
| 32 rtcp_receiver_(rtcp_receiver) { | |
| 33 } | |
| 34 | 31 |
| 35 bool SendRtp(const uint8_t* /*data*/, | 32 bool SendRtp(const uint8_t* /*data*/, |
| 36 size_t /*len*/, | 33 size_t /*len*/, |
| 37 const PacketOptions& options) override { | 34 const PacketOptions& options) override { |
| 38 return false; | 35 return false; |
| 39 } | 36 } |
| 40 bool SendRtcp(const uint8_t* packet, size_t packetLength) override { | 37 bool SendRtcp(const uint8_t* packet, size_t packetLength) override { |
| 41 RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, | 38 RTCPUtility::RTCPParserV2 rtcpParser(packet, packetLength, |
| 42 packetLength, | 39 true); // Allow non-compound RTCP |
| 43 true); // Allow non-compound RTCP | |
| 44 | 40 |
| 45 EXPECT_TRUE(rtcpParser.IsValid()); | 41 EXPECT_TRUE(rtcpParser.IsValid()); |
| 46 RTCPHelp::RTCPPacketInformation rtcpPacketInformation; | 42 RTCPHelp::RTCPPacketInformation rtcpPacketInformation; |
| 47 EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation, | 43 EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation, |
| 48 &rtcpParser)); | 44 &rtcpParser)); |
| 49 | 45 |
| 50 EXPECT_EQ((uint32_t)kRtcpRemb, | 46 EXPECT_EQ((uint32_t)kRtcpRemb, |
| 51 rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb); | 47 rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRemb); |
| 52 EXPECT_EQ((uint32_t)1234, | 48 EXPECT_EQ((uint32_t)1234, |
| 53 rtcpPacketInformation.receiverEstimatedMaxBitrate); | 49 rtcpPacketInformation.receiverEstimatedMaxBitrate); |
| 54 return true; | 50 return true; |
| 55 } | 51 } |
| 52 |
| 56 private: | 53 private: |
| 57 RTCPReceiver* rtcp_receiver_; | 54 RTCPReceiver* rtcp_receiver_; |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 | |
| 61 class RtcpFormatRembTest : public ::testing::Test { | 57 class RtcpFormatRembTest : public ::testing::Test { |
| 62 protected: | 58 protected: |
| 63 RtcpFormatRembTest() | 59 RtcpFormatRembTest() |
| 64 : over_use_detector_options_(), | 60 : over_use_detector_options_(), |
| 65 system_clock_(Clock::GetRealTimeClock()), | 61 system_clock_(Clock::GetRealTimeClock()), |
| 66 dummy_rtp_rtcp_impl_(nullptr), | 62 dummy_rtp_rtcp_impl_(nullptr), |
| 67 receive_statistics_(ReceiveStatistics::Create(system_clock_)), | 63 receive_statistics_(ReceiveStatistics::Create(system_clock_)), |
| 68 rtcp_sender_(nullptr), | 64 rtcp_sender_(nullptr), |
| 69 rtcp_receiver_(nullptr), | 65 rtcp_receiver_(nullptr), |
| 70 test_transport_(nullptr), | 66 test_transport_(nullptr), |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 123 |
| 128 TEST_F(RtcpFormatRembTest, TestCompund) { | 124 TEST_F(RtcpFormatRembTest, TestCompund) { |
| 129 uint32_t SSRCs[2] = {456789, 98765}; | 125 uint32_t SSRCs[2] = {456789, 98765}; |
| 130 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); | 126 rtcp_sender_->SetRTCPStatus(RtcpMode::kCompound); |
| 131 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); | 127 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); |
| 132 RTCPSender::FeedbackState feedback_state = | 128 RTCPSender::FeedbackState feedback_state = |
| 133 dummy_rtp_rtcp_impl_->GetFeedbackState(); | 129 dummy_rtp_rtcp_impl_->GetFeedbackState(); |
| 134 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); | 130 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); |
| 135 } | 131 } |
| 136 } // namespace | 132 } // namespace |
| OLD | NEW |