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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 RtpRtcpAudioTest() : fake_clock(123456) { | 79 RtpRtcpAudioTest() : fake_clock(123456) { |
80 test_CSRC[0] = 1234; | 80 test_CSRC[0] = 1234; |
81 test_CSRC[2] = 2345; | 81 test_CSRC[2] = 2345; |
82 test_ssrc = 3456; | 82 test_ssrc = 3456; |
83 test_timestamp = 4567; | 83 test_timestamp = 4567; |
84 test_sequence_number = 2345; | 84 test_sequence_number = 2345; |
85 } | 85 } |
86 ~RtpRtcpAudioTest() {} | 86 ~RtpRtcpAudioTest() {} |
87 | 87 |
88 void SetUp() override { | 88 void SetUp() override { |
| 89 audioFeedback = new NullRtpAudioFeedback(); |
89 data_receiver1 = new VerifyingAudioReceiver(); | 90 data_receiver1 = new VerifyingAudioReceiver(); |
90 data_receiver2 = new VerifyingAudioReceiver(); | 91 data_receiver2 = new VerifyingAudioReceiver(); |
91 rtp_callback = new RTPCallback(); | 92 rtp_callback = new RTPCallback(); |
92 transport1 = new LoopBackTransport(); | 93 transport1 = new LoopBackTransport(); |
93 transport2 = new LoopBackTransport(); | 94 transport2 = new LoopBackTransport(); |
94 | 95 |
95 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); | 96 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); |
96 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); | 97 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); |
97 | 98 |
98 rtp_payload_registry1_.reset(new RTPPayloadRegistry( | 99 rtp_payload_registry1_.reset(new RTPPayloadRegistry( |
99 RTPPayloadStrategy::CreateStrategy(true))); | 100 RTPPayloadStrategy::CreateStrategy(true))); |
100 rtp_payload_registry2_.reset(new RTPPayloadRegistry( | 101 rtp_payload_registry2_.reset(new RTPPayloadRegistry( |
101 RTPPayloadStrategy::CreateStrategy(true))); | 102 RTPPayloadStrategy::CreateStrategy(true))); |
102 | 103 |
103 RtpRtcp::Configuration configuration; | 104 RtpRtcp::Configuration configuration; |
104 configuration.audio = true; | 105 configuration.audio = true; |
105 configuration.clock = &fake_clock; | 106 configuration.clock = &fake_clock; |
106 configuration.receive_statistics = receive_statistics1_.get(); | 107 configuration.receive_statistics = receive_statistics1_.get(); |
107 configuration.outgoing_transport = transport1; | 108 configuration.outgoing_transport = transport1; |
108 | 109 |
109 module1 = RtpRtcp::CreateRtpRtcp(configuration); | 110 module1 = RtpRtcp::CreateRtpRtcp(configuration); |
110 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( | 111 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( |
111 &fake_clock, data_receiver1, NULL, rtp_payload_registry1_.get())); | 112 &fake_clock, audioFeedback, data_receiver1, NULL, |
| 113 rtp_payload_registry1_.get())); |
112 | 114 |
113 configuration.receive_statistics = receive_statistics2_.get(); | 115 configuration.receive_statistics = receive_statistics2_.get(); |
114 configuration.outgoing_transport = transport2; | 116 configuration.outgoing_transport = transport2; |
115 | 117 |
116 module2 = RtpRtcp::CreateRtpRtcp(configuration); | 118 module2 = RtpRtcp::CreateRtpRtcp(configuration); |
117 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( | 119 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( |
118 &fake_clock, data_receiver2, NULL, rtp_payload_registry2_.get())); | 120 &fake_clock, audioFeedback, data_receiver2, NULL, |
| 121 rtp_payload_registry2_.get())); |
119 | 122 |
120 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), | 123 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), |
121 rtp_receiver2_.get(), receive_statistics2_.get()); | 124 rtp_receiver2_.get(), receive_statistics2_.get()); |
122 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), | 125 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), |
123 rtp_receiver1_.get(), receive_statistics1_.get()); | 126 rtp_receiver1_.get(), receive_statistics1_.get()); |
124 } | 127 } |
125 | 128 |
126 void TearDown() override { | 129 void TearDown() override { |
127 delete module1; | 130 delete module1; |
128 delete module2; | 131 delete module2; |
129 delete transport1; | 132 delete transport1; |
130 delete transport2; | 133 delete transport2; |
| 134 delete audioFeedback; |
131 delete data_receiver1; | 135 delete data_receiver1; |
132 delete data_receiver2; | 136 delete data_receiver2; |
133 delete rtp_callback; | 137 delete rtp_callback; |
134 } | 138 } |
135 | 139 |
136 RtpRtcp* module1; | 140 RtpRtcp* module1; |
137 RtpRtcp* module2; | 141 RtpRtcp* module2; |
138 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; | 142 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; |
139 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; | 143 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; |
140 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; | 144 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; |
141 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; | 145 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; |
142 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; | 146 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; |
143 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; | 147 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; |
144 VerifyingAudioReceiver* data_receiver1; | 148 VerifyingAudioReceiver* data_receiver1; |
145 VerifyingAudioReceiver* data_receiver2; | 149 VerifyingAudioReceiver* data_receiver2; |
146 LoopBackTransport* transport1; | 150 LoopBackTransport* transport1; |
147 LoopBackTransport* transport2; | 151 LoopBackTransport* transport2; |
| 152 NullRtpAudioFeedback* audioFeedback; |
148 RTPCallback* rtp_callback; | 153 RTPCallback* rtp_callback; |
149 uint32_t test_ssrc; | 154 uint32_t test_ssrc; |
150 uint32_t test_timestamp; | 155 uint32_t test_timestamp; |
151 uint16_t test_sequence_number; | 156 uint16_t test_sequence_number; |
152 uint32_t test_CSRC[webrtc::kRtpCsrcSize]; | 157 uint32_t test_CSRC[webrtc::kRtpCsrcSize]; |
153 SimulatedClock fake_clock; | 158 SimulatedClock fake_clock; |
154 }; | 159 }; |
155 | 160 |
156 TEST_F(RtpRtcpAudioTest, Basic) { | 161 TEST_F(RtpRtcpAudioTest, Basic) { |
157 module1->SetSSRC(test_ssrc); | 162 module1->SetSSRC(test_ssrc); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 for (; timeStamp <= 740 * 160; timeStamp += 160) { | 343 for (; timeStamp <= 740 * 160; timeStamp += 160) { |
339 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, | 344 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, |
340 timeStamp, -1, test, 4)); | 345 timeStamp, -1, test, 4)); |
341 fake_clock.AdvanceTimeMilliseconds(20); | 346 fake_clock.AdvanceTimeMilliseconds(20); |
342 module1->Process(); | 347 module1->Process(); |
343 } | 348 } |
344 } | 349 } |
345 | 350 |
346 } // namespace | 351 } // namespace |
347 } // namespace webrtc | 352 } // namespace webrtc |
OLD | NEW |