| 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 21 matching lines...) Expand all Loading... |
| 32 // This test transport verifies that no functions get called. | 32 // This test transport verifies that no functions get called. |
| 33 class TestTransport : public Transport, | 33 class TestTransport : public Transport, |
| 34 public NullRtpData { | 34 public NullRtpData { |
| 35 public: | 35 public: |
| 36 explicit TestTransport() | 36 explicit TestTransport() |
| 37 : rtcp_receiver_(NULL) { | 37 : rtcp_receiver_(NULL) { |
| 38 } | 38 } |
| 39 void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { | 39 void SetRTCPReceiver(RTCPReceiver* rtcp_receiver) { |
| 40 rtcp_receiver_ = rtcp_receiver; | 40 rtcp_receiver_ = rtcp_receiver; |
| 41 } | 41 } |
| 42 int SendPacket(int /*ch*/, const void* /*data*/, size_t /*len*/) override { | 42 int SendPacket(const void* /*data*/, size_t /*len*/) override { |
| 43 ADD_FAILURE(); // FAIL() gives a compile error. | 43 ADD_FAILURE(); // FAIL() gives a compile error. |
| 44 return -1; | 44 return -1; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Injects an RTCP packet into the receiver. | 47 int SendRTCPPacket(const void* packet, size_t packet_len) override { |
| 48 int SendRTCPPacket(int /* ch */, | |
| 49 const void* packet, | |
| 50 size_t packet_len) override { | |
| 51 ADD_FAILURE(); | 48 ADD_FAILURE(); |
| 52 return 0; | 49 return 0; |
| 53 } | 50 } |
| 54 | 51 |
| 55 int OnReceivedPayloadData(const uint8_t* payloadData, | 52 int OnReceivedPayloadData(const uint8_t* payloadData, |
| 56 const size_t payloadSize, | 53 const size_t payloadSize, |
| 57 const WebRtcRTPHeader* rtpHeader) override { | 54 const WebRtcRTPHeader* rtpHeader) override { |
| 58 ADD_FAILURE(); | 55 ADD_FAILURE(); |
| 59 return 0; | 56 return 0; |
| 60 } | 57 } |
| 61 RTCPReceiver* rtcp_receiver_; | 58 RTCPReceiver* rtcp_receiver_; |
| 62 }; | 59 }; |
| 63 | 60 |
| 64 class RtcpReceiverTest : public ::testing::Test { | 61 class RtcpReceiverTest : public ::testing::Test { |
| 65 protected: | 62 protected: |
| 66 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000; | 63 static const uint32_t kRemoteBitrateEstimatorMinBitrateBps = 30000; |
| 67 | 64 |
| 68 RtcpReceiverTest() | 65 RtcpReceiverTest() |
| 69 : over_use_detector_options_(), | 66 : over_use_detector_options_(), |
| 70 system_clock_(1335900000), | 67 system_clock_(1335900000), |
| 71 remote_bitrate_observer_(), | 68 remote_bitrate_observer_(), |
| 72 remote_bitrate_estimator_(new RemoteBitrateEstimatorSingleStream( | 69 remote_bitrate_estimator_(new RemoteBitrateEstimatorSingleStream( |
| 73 &remote_bitrate_observer_, | 70 &remote_bitrate_observer_, |
| 74 &system_clock_, | 71 &system_clock_, |
| 75 kRemoteBitrateEstimatorMinBitrateBps)) { | 72 kRemoteBitrateEstimatorMinBitrateBps)) { |
| 76 test_transport_ = new TestTransport(); | 73 test_transport_ = new TestTransport(); |
| 77 | 74 |
| 78 RtpRtcp::Configuration configuration; | 75 RtpRtcp::Configuration configuration; |
| 79 configuration.id = 0; | |
| 80 configuration.audio = false; | 76 configuration.audio = false; |
| 81 configuration.clock = &system_clock_; | 77 configuration.clock = &system_clock_; |
| 82 configuration.outgoing_transport = test_transport_; | 78 configuration.outgoing_transport = test_transport_; |
| 83 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); | 79 configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get(); |
| 84 rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); | 80 rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration); |
| 85 rtcp_receiver_ = new RTCPReceiver(0, &system_clock_, false, NULL, NULL, | 81 rtcp_receiver_ = new RTCPReceiver(&system_clock_, false, NULL, NULL, NULL, |
| 86 NULL, rtp_rtcp_impl_); | 82 rtp_rtcp_impl_); |
| 87 test_transport_->SetRTCPReceiver(rtcp_receiver_); | 83 test_transport_->SetRTCPReceiver(rtcp_receiver_); |
| 88 } | 84 } |
| 89 ~RtcpReceiverTest() { | 85 ~RtcpReceiverTest() { |
| 90 delete rtcp_receiver_; | 86 delete rtcp_receiver_; |
| 91 delete rtp_rtcp_impl_; | 87 delete rtp_rtcp_impl_; |
| 92 delete test_transport_; | 88 delete test_transport_; |
| 93 } | 89 } |
| 94 | 90 |
| 95 // Injects an RTCP packet into the receiver. | 91 // Injects an RTCP packet into the receiver. |
| 96 // Returns 0 for OK, non-0 for failure. | 92 // Returns 0 for OK, non-0 for failure. |
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 rr2.WithReportBlock(rb2); | 1023 rr2.WithReportBlock(rb2); |
| 1028 rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); | 1024 rtc::scoped_ptr<rtcp::RawPacket> p2(rr2.Build()); |
| 1029 EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); | 1025 EXPECT_EQ(0, InjectRtcpPacket(p2->Buffer(), p2->Length())); |
| 1030 EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, | 1026 EXPECT_TRUE(callback.Matches(kSourceSsrc, kSequenceNumber, kFractionLoss, |
| 1031 kCumulativeLoss, kJitter)); | 1027 kCumulativeLoss, kJitter)); |
| 1032 } | 1028 } |
| 1033 | 1029 |
| 1034 } // Anonymous namespace | 1030 } // Anonymous namespace |
| 1035 | 1031 |
| 1036 } // namespace webrtc | 1032 } // namespace webrtc |
| OLD | NEW |