| 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/typedefs.h" | 22 #include "webrtc/typedefs.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 using namespace webrtc; | 26 using namespace webrtc; |
| 26 | 27 |
| 27 | 28 |
| 28 class TestTransport : public Transport { | 29 class TestTransport : public Transport { |
| 29 public: | 30 public: |
| 30 TestTransport(RTCPReceiver* rtcp_receiver) : | 31 TestTransport(RTCPReceiver* rtcp_receiver) : |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void SetUp() override; | 73 void SetUp() override; |
| 73 void TearDown() override; | 74 void TearDown() override; |
| 74 | 75 |
| 75 OverUseDetectorOptions over_use_detector_options_; | 76 OverUseDetectorOptions over_use_detector_options_; |
| 76 Clock* system_clock_; | 77 Clock* system_clock_; |
| 77 ModuleRtpRtcpImpl* dummy_rtp_rtcp_impl_; | 78 ModuleRtpRtcpImpl* dummy_rtp_rtcp_impl_; |
| 78 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; | 79 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; |
| 79 RTCPSender* rtcp_sender_; | 80 RTCPSender* rtcp_sender_; |
| 80 RTCPReceiver* rtcp_receiver_; | 81 RTCPReceiver* rtcp_receiver_; |
| 81 TestTransport* test_transport_; | 82 TestTransport* test_transport_; |
| 83 test::NullTransport null_transport_; |
| 82 MockRemoteBitrateObserver remote_bitrate_observer_; | 84 MockRemoteBitrateObserver remote_bitrate_observer_; |
| 83 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 85 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 void RtcpFormatRembTest::SetUp() { | 88 void RtcpFormatRembTest::SetUp() { |
| 87 RtpRtcp::Configuration configuration; | 89 RtpRtcp::Configuration configuration; |
| 88 configuration.audio = false; | 90 configuration.audio = false; |
| 89 configuration.clock = system_clock_; | 91 configuration.clock = system_clock_; |
| 90 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); | 92 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); |
| 93 configuration.outgoing_transport = &null_transport_; |
| 91 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); | 94 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); |
| 92 rtcp_sender_ = | |
| 93 new RTCPSender(false, system_clock_, receive_statistics_.get(), nullptr); | |
| 94 rtcp_receiver_ = new RTCPReceiver(system_clock_, false, nullptr, nullptr, | 95 rtcp_receiver_ = new RTCPReceiver(system_clock_, false, nullptr, nullptr, |
| 95 nullptr, nullptr, dummy_rtp_rtcp_impl_); | 96 nullptr, nullptr, dummy_rtp_rtcp_impl_); |
| 96 test_transport_ = new TestTransport(rtcp_receiver_); | 97 test_transport_ = new TestTransport(rtcp_receiver_); |
| 97 | 98 rtcp_sender_ = new RTCPSender(false, system_clock_, receive_statistics_.get(), |
| 98 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_)); | 99 nullptr, test_transport_); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void RtcpFormatRembTest::TearDown() { | 102 void RtcpFormatRembTest::TearDown() { |
| 102 delete rtcp_sender_; | 103 delete rtcp_sender_; |
| 103 delete rtcp_receiver_; | 104 delete rtcp_receiver_; |
| 104 delete dummy_rtp_rtcp_impl_; | 105 delete dummy_rtp_rtcp_impl_; |
| 105 delete test_transport_; | 106 delete test_transport_; |
| 106 } | 107 } |
| 107 | 108 |
| 108 TEST_F(RtcpFormatRembTest, TestRembStatus) { | 109 TEST_F(RtcpFormatRembTest, TestRembStatus) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 124 | 125 |
| 125 TEST_F(RtcpFormatRembTest, TestCompund) { | 126 TEST_F(RtcpFormatRembTest, TestCompund) { |
| 126 uint32_t SSRCs[2] = {456789, 98765}; | 127 uint32_t SSRCs[2] = {456789, 98765}; |
| 127 rtcp_sender_->SetRTCPStatus(kRtcpCompound); | 128 rtcp_sender_->SetRTCPStatus(kRtcpCompound); |
| 128 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); | 129 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); |
| 129 RTCPSender::FeedbackState feedback_state = | 130 RTCPSender::FeedbackState feedback_state = |
| 130 dummy_rtp_rtcp_impl_->GetFeedbackState(); | 131 dummy_rtp_rtcp_impl_->GetFeedbackState(); |
| 131 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); | 132 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); |
| 132 } | 133 } |
| 133 } // namespace | 134 } // namespace |
| OLD | NEW |