| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 using namespace webrtc; | 25 using namespace webrtc; |
| 26 | 26 |
| 27 | 27 |
| 28 class TestTransport : public Transport { | 28 class TestTransport : public Transport { |
| 29 public: | 29 public: |
| 30 TestTransport(RTCPReceiver* rtcp_receiver) : | 30 TestTransport(RTCPReceiver* rtcp_receiver) : |
| 31 rtcp_receiver_(rtcp_receiver) { | 31 rtcp_receiver_(rtcp_receiver) { |
| 32 } | 32 } |
| 33 | 33 |
| 34 int SendPacket(int /*channel*/, | 34 int SendPacket(const void* /*data*/, size_t /*len*/) override { return -1; } |
| 35 const void* /*data*/, | 35 int SendRTCPPacket(const void* packet, size_t packetLength) override { |
| 36 size_t /*len*/) override { | |
| 37 return -1; | |
| 38 } | |
| 39 int SendRTCPPacket(int /*channel*/, | |
| 40 const void* packet, | |
| 41 size_t packetLength) override { | |
| 42 RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, | 36 RTCPUtility::RTCPParserV2 rtcpParser((uint8_t*)packet, |
| 43 packetLength, | 37 packetLength, |
| 44 true); // Allow non-compound RTCP | 38 true); // Allow non-compound RTCP |
| 45 | 39 |
| 46 EXPECT_TRUE(rtcpParser.IsValid()); | 40 EXPECT_TRUE(rtcpParser.IsValid()); |
| 47 RTCPHelp::RTCPPacketInformation rtcpPacketInformation; | 41 RTCPHelp::RTCPPacketInformation rtcpPacketInformation; |
| 48 EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation, | 42 EXPECT_EQ(0, rtcp_receiver_->IncomingRTCPPacket(rtcpPacketInformation, |
| 49 &rtcpParser)); | 43 &rtcpParser)); |
| 50 | 44 |
| 51 EXPECT_EQ((uint32_t)kRtcpRemb, | 45 EXPECT_EQ((uint32_t)kRtcpRemb, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 81 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; | 75 rtc::scoped_ptr<ReceiveStatistics> receive_statistics_; |
| 82 RTCPSender* rtcp_sender_; | 76 RTCPSender* rtcp_sender_; |
| 83 RTCPReceiver* rtcp_receiver_; | 77 RTCPReceiver* rtcp_receiver_; |
| 84 TestTransport* test_transport_; | 78 TestTransport* test_transport_; |
| 85 MockRemoteBitrateObserver remote_bitrate_observer_; | 79 MockRemoteBitrateObserver remote_bitrate_observer_; |
| 86 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 80 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
| 87 }; | 81 }; |
| 88 | 82 |
| 89 void RtcpFormatRembTest::SetUp() { | 83 void RtcpFormatRembTest::SetUp() { |
| 90 RtpRtcp::Configuration configuration; | 84 RtpRtcp::Configuration configuration; |
| 91 configuration.id = 0; | |
| 92 configuration.audio = false; | 85 configuration.audio = false; |
| 93 configuration.clock = system_clock_; | 86 configuration.clock = system_clock_; |
| 94 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); | 87 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); |
| 95 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); | 88 dummy_rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); |
| 96 rtcp_sender_ = new RTCPSender(0, false, system_clock_, | 89 rtcp_sender_ = |
| 97 receive_statistics_.get(), NULL); | 90 new RTCPSender(false, system_clock_, receive_statistics_.get(), NULL); |
| 98 rtcp_receiver_ = new RTCPReceiver(0, system_clock_, false, NULL, NULL, NULL, | 91 rtcp_receiver_ = new RTCPReceiver(system_clock_, false, NULL, NULL, NULL, |
| 99 dummy_rtp_rtcp_impl_); | 92 dummy_rtp_rtcp_impl_); |
| 100 test_transport_ = new TestTransport(rtcp_receiver_); | 93 test_transport_ = new TestTransport(rtcp_receiver_); |
| 101 | 94 |
| 102 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_)); | 95 EXPECT_EQ(0, rtcp_sender_->RegisterSendTransport(test_transport_)); |
| 103 } | 96 } |
| 104 | 97 |
| 105 void RtcpFormatRembTest::TearDown() { | 98 void RtcpFormatRembTest::TearDown() { |
| 106 delete rtcp_sender_; | 99 delete rtcp_sender_; |
| 107 delete rtcp_receiver_; | 100 delete rtcp_receiver_; |
| 108 delete dummy_rtp_rtcp_impl_; | 101 delete dummy_rtp_rtcp_impl_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 128 | 121 |
| 129 TEST_F(RtcpFormatRembTest, TestCompund) { | 122 TEST_F(RtcpFormatRembTest, TestCompund) { |
| 130 uint32_t SSRCs[2] = {456789, 98765}; | 123 uint32_t SSRCs[2] = {456789, 98765}; |
| 131 rtcp_sender_->SetRTCPStatus(kRtcpCompound); | 124 rtcp_sender_->SetRTCPStatus(kRtcpCompound); |
| 132 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); | 125 rtcp_sender_->SetREMBData(1234, std::vector<uint32_t>(SSRCs, SSRCs + 2)); |
| 133 RTCPSender::FeedbackState feedback_state = | 126 RTCPSender::FeedbackState feedback_state = |
| 134 dummy_rtp_rtcp_impl_->GetFeedbackState(); | 127 dummy_rtp_rtcp_impl_->GetFeedbackState(); |
| 135 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); | 128 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state, kRtcpRemb)); |
| 136 } | 129 } |
| 137 } // namespace | 130 } // namespace |
| OLD | NEW |