| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) {}; | 48 virtual void OnLocalSsrcChanged(uint32_t old_ssrc, uint32_t new_ssrc) {}; |
| 49 private: | 49 private: |
| 50 RtpRtcp* _rtpRtcpModule; | 50 RtpRtcp* _rtpRtcpModule; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class TestRtpFeedback : public NullRtpFeedback { | 53 class TestRtpFeedback : public NullRtpFeedback { |
| 54 public: | 54 public: |
| 55 TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {} | 55 TestRtpFeedback(RtpRtcp* rtp_rtcp) : rtp_rtcp_(rtp_rtcp) {} |
| 56 virtual ~TestRtpFeedback() {} | 56 virtual ~TestRtpFeedback() {} |
| 57 | 57 |
| 58 virtual void OnIncomingSSRCChanged(const int32_t id, | 58 void OnIncomingSSRCChanged(const uint32_t ssrc) override { |
| 59 const uint32_t ssrc) { | |
| 60 rtp_rtcp_->SetRemoteSSRC(ssrc); | 59 rtp_rtcp_->SetRemoteSSRC(ssrc); |
| 61 } | 60 } |
| 62 | 61 |
| 63 private: | 62 private: |
| 64 RtpRtcp* rtp_rtcp_; | 63 RtpRtcp* rtp_rtcp_; |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 class RtpRtcpRtcpTest : public ::testing::Test { | 66 class RtpRtcpRtcpTest : public ::testing::Test { |
| 68 protected: | 67 protected: |
| 69 RtpRtcpRtcpTest() : fake_clock(123456) { | 68 RtpRtcpRtcpTest() : fake_clock(123456) { |
| 70 test_csrcs.push_back(1234); | 69 test_csrcs.push_back(1234); |
| 71 test_csrcs.push_back(2345); | 70 test_csrcs.push_back(2345); |
| 72 test_id = 123; | |
| 73 test_ssrc = 3456; | 71 test_ssrc = 3456; |
| 74 test_timestamp = 4567; | 72 test_timestamp = 4567; |
| 75 test_sequence_number = 2345; | 73 test_sequence_number = 2345; |
| 76 } | 74 } |
| 77 ~RtpRtcpRtcpTest() {} | 75 ~RtpRtcpRtcpTest() {} |
| 78 | 76 |
| 79 virtual void SetUp() { | 77 virtual void SetUp() { |
| 80 receiver = new TestRtpReceiver(); | 78 receiver = new TestRtpReceiver(); |
| 81 transport1 = new LoopBackTransport(); | 79 transport1 = new LoopBackTransport(); |
| 82 transport2 = new LoopBackTransport(); | 80 transport2 = new LoopBackTransport(); |
| 83 myRTCPFeedback1 = new RtcpCallback(); | 81 myRTCPFeedback1 = new RtcpCallback(); |
| 84 myRTCPFeedback2 = new RtcpCallback(); | 82 myRTCPFeedback2 = new RtcpCallback(); |
| 85 | 83 |
| 86 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); | 84 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); |
| 87 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); | 85 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); |
| 88 | 86 |
| 89 RtpRtcp::Configuration configuration; | 87 RtpRtcp::Configuration configuration; |
| 90 configuration.id = test_id; | |
| 91 configuration.audio = true; | 88 configuration.audio = true; |
| 92 configuration.clock = &fake_clock; | 89 configuration.clock = &fake_clock; |
| 93 configuration.receive_statistics = receive_statistics1_.get(); | 90 configuration.receive_statistics = receive_statistics1_.get(); |
| 94 configuration.outgoing_transport = transport1; | 91 configuration.outgoing_transport = transport1; |
| 95 configuration.intra_frame_callback = myRTCPFeedback1; | 92 configuration.intra_frame_callback = myRTCPFeedback1; |
| 96 | 93 |
| 97 rtp_payload_registry1_.reset(new RTPPayloadRegistry( | 94 rtp_payload_registry1_.reset(new RTPPayloadRegistry( |
| 98 RTPPayloadStrategy::CreateStrategy(true))); | 95 RTPPayloadStrategy::CreateStrategy(true))); |
| 99 rtp_payload_registry2_.reset(new RTPPayloadRegistry( | 96 rtp_payload_registry2_.reset(new RTPPayloadRegistry( |
| 100 RTPPayloadStrategy::CreateStrategy(true))); | 97 RTPPayloadStrategy::CreateStrategy(true))); |
| 101 | 98 |
| 102 module1 = RtpRtcp::CreateRtpRtcp(configuration); | 99 module1 = RtpRtcp::CreateRtpRtcp(configuration); |
| 103 | 100 |
| 104 rtp_feedback1_.reset(new TestRtpFeedback(module1)); | 101 rtp_feedback1_.reset(new TestRtpFeedback(module1)); |
| 105 | 102 |
| 106 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( | 103 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( |
| 107 test_id, &fake_clock, NULL, receiver, rtp_feedback1_.get(), | 104 &fake_clock, NULL, receiver, rtp_feedback1_.get(), |
| 108 rtp_payload_registry1_.get())); | 105 rtp_payload_registry1_.get())); |
| 109 | 106 |
| 110 configuration.receive_statistics = receive_statistics2_.get(); | 107 configuration.receive_statistics = receive_statistics2_.get(); |
| 111 configuration.id = test_id + 1; | |
| 112 configuration.outgoing_transport = transport2; | 108 configuration.outgoing_transport = transport2; |
| 113 configuration.intra_frame_callback = myRTCPFeedback2; | 109 configuration.intra_frame_callback = myRTCPFeedback2; |
| 114 | 110 |
| 115 module2 = RtpRtcp::CreateRtpRtcp(configuration); | 111 module2 = RtpRtcp::CreateRtpRtcp(configuration); |
| 116 | 112 |
| 117 rtp_feedback2_.reset(new TestRtpFeedback(module2)); | 113 rtp_feedback2_.reset(new TestRtpFeedback(module2)); |
| 118 | 114 |
| 119 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( | 115 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( |
| 120 test_id + 1, &fake_clock, NULL, receiver, rtp_feedback2_.get(), | 116 &fake_clock, NULL, receiver, rtp_feedback2_.get(), |
| 121 rtp_payload_registry2_.get())); | 117 rtp_payload_registry2_.get())); |
| 122 | 118 |
| 123 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), | 119 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), |
| 124 rtp_receiver2_.get(), receive_statistics2_.get()); | 120 rtp_receiver2_.get(), receive_statistics2_.get()); |
| 125 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), | 121 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), |
| 126 rtp_receiver1_.get(), receive_statistics1_.get()); | 122 rtp_receiver1_.get(), receive_statistics1_.get()); |
| 127 myRTCPFeedback1->SetModule(module1); | 123 myRTCPFeedback1->SetModule(module1); |
| 128 myRTCPFeedback2->SetModule(module2); | 124 myRTCPFeedback2->SetModule(module2); |
| 129 | 125 |
| 130 module1->SetRTCPStatus(kRtcpCompound); | 126 module1->SetRTCPStatus(kRtcpCompound); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 virtual void TearDown() { | 168 virtual void TearDown() { |
| 173 delete module1; | 169 delete module1; |
| 174 delete module2; | 170 delete module2; |
| 175 delete myRTCPFeedback1; | 171 delete myRTCPFeedback1; |
| 176 delete myRTCPFeedback2; | 172 delete myRTCPFeedback2; |
| 177 delete transport1; | 173 delete transport1; |
| 178 delete transport2; | 174 delete transport2; |
| 179 delete receiver; | 175 delete receiver; |
| 180 } | 176 } |
| 181 | 177 |
| 182 int test_id; | |
| 183 rtc::scoped_ptr<TestRtpFeedback> rtp_feedback1_; | 178 rtc::scoped_ptr<TestRtpFeedback> rtp_feedback1_; |
| 184 rtc::scoped_ptr<TestRtpFeedback> rtp_feedback2_; | 179 rtc::scoped_ptr<TestRtpFeedback> rtp_feedback2_; |
| 185 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; | 180 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; |
| 186 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; | 181 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; |
| 187 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; | 182 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; |
| 188 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; | 183 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; |
| 189 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; | 184 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; |
| 190 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; | 185 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; |
| 191 RtpRtcp* module1; | 186 RtpRtcp* module1; |
| 192 RtpRtcp* module2; | 187 RtpRtcp* module2; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 259 |
| 265 // |test_ssrc+1| is the SSRC of module2 that send the report. | 260 // |test_ssrc+1| is the SSRC of module2 that send the report. |
| 266 EXPECT_EQ(test_ssrc+1, report_blocks[0].remoteSSRC); | 261 EXPECT_EQ(test_ssrc+1, report_blocks[0].remoteSSRC); |
| 267 EXPECT_EQ(test_ssrc, report_blocks[0].sourceSSRC); | 262 EXPECT_EQ(test_ssrc, report_blocks[0].sourceSSRC); |
| 268 | 263 |
| 269 EXPECT_EQ(0u, report_blocks[0].cumulativeLost); | 264 EXPECT_EQ(0u, report_blocks[0].cumulativeLost); |
| 270 EXPECT_LT(0u, report_blocks[0].delaySinceLastSR); | 265 EXPECT_LT(0u, report_blocks[0].delaySinceLastSR); |
| 271 EXPECT_EQ(test_sequence_number, report_blocks[0].extendedHighSeqNum); | 266 EXPECT_EQ(test_sequence_number, report_blocks[0].extendedHighSeqNum); |
| 272 EXPECT_EQ(0u, report_blocks[0].fractionLost); | 267 EXPECT_EQ(0u, report_blocks[0].fractionLost); |
| 273 } | 268 } |
| OLD | NEW |