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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 EXPECT_EQ(true, | 201 EXPECT_EQ(true, |
202 module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1, | 202 module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1, |
203 test, 4, nullptr, nullptr, nullptr)); | 203 test, 4, nullptr, nullptr, nullptr)); |
204 | 204 |
205 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC()); | 205 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC()); |
206 uint32_t timestamp; | 206 uint32_t timestamp; |
207 EXPECT_TRUE(rtp_receiver2_->Timestamp(×tamp)); | 207 EXPECT_TRUE(rtp_receiver2_->Timestamp(×tamp)); |
208 EXPECT_EQ(test_timestamp, timestamp); | 208 EXPECT_EQ(test_timestamp, timestamp); |
209 } | 209 } |
210 | 210 |
211 TEST_F(RtpRtcpAudioTest, RED) { | |
212 CodecInst voice_codec; | |
213 memset(&voice_codec, 0, sizeof(voice_codec)); | |
214 voice_codec.pltype = 96; | |
215 voice_codec.plfreq = 8000; | |
216 memcpy(voice_codec.plname, "PCMU", 5); | |
217 | |
218 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); | |
219 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( | |
220 voice_codec.plname, | |
221 voice_codec.pltype, | |
222 voice_codec.plfreq, | |
223 voice_codec.channels, | |
224 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); | |
225 EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec)); | |
226 voice_codec.rate = test_rate; | |
227 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( | |
228 voice_codec.plname, | |
229 voice_codec.pltype, | |
230 voice_codec.plfreq, | |
231 voice_codec.channels, | |
232 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); | |
233 | |
234 module1->SetSSRC(test_ssrc); | |
235 module1->SetStartTimestamp(test_timestamp); | |
236 EXPECT_EQ(0, module1->SetSendingStatus(true)); | |
237 | |
238 voice_codec.pltype = 127; | |
239 voice_codec.plfreq = 8000; | |
240 memcpy(voice_codec.plname, "RED", 4); | |
241 | |
242 EXPECT_EQ(0, module1->SetSendREDPayloadType(voice_codec.pltype)); | |
243 int8_t red = 0; | |
244 EXPECT_EQ(0, module1->SendREDPayloadType(&red)); | |
245 EXPECT_EQ(voice_codec.pltype, red); | |
246 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( | |
247 voice_codec.plname, | |
248 voice_codec.pltype, | |
249 voice_codec.plfreq, | |
250 voice_codec.channels, | |
251 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); | |
252 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( | |
253 voice_codec.plname, | |
254 voice_codec.pltype, | |
255 voice_codec.plfreq, | |
256 voice_codec.channels, | |
257 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); | |
258 | |
259 RTPFragmentationHeader fragmentation; | |
260 fragmentation.fragmentationVectorSize = 2; | |
261 fragmentation.fragmentationLength = new size_t[2]; | |
262 fragmentation.fragmentationLength[0] = 4; | |
263 fragmentation.fragmentationLength[1] = 4; | |
264 fragmentation.fragmentationOffset = new size_t[2]; | |
265 fragmentation.fragmentationOffset[0] = 0; | |
266 fragmentation.fragmentationOffset[1] = 4; | |
267 fragmentation.fragmentationTimeDiff = new uint16_t[2]; | |
268 fragmentation.fragmentationTimeDiff[0] = 0; | |
269 fragmentation.fragmentationTimeDiff[1] = 0; | |
270 fragmentation.fragmentationPlType = new uint8_t[2]; | |
271 fragmentation.fragmentationPlType[0] = 96; | |
272 fragmentation.fragmentationPlType[1] = 96; | |
273 | |
274 const uint8_t test[5] = "test"; | |
275 // Send a RTP packet. | |
276 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 160, -1, | |
277 test, 4, &fragmentation, nullptr, | |
278 nullptr)); | |
279 | |
280 EXPECT_EQ(0, module1->SetSendREDPayloadType(-1)); | |
281 EXPECT_EQ(-1, module1->SendREDPayloadType(&red)); | |
282 } | |
283 | |
284 TEST_F(RtpRtcpAudioTest, DTMF) { | 211 TEST_F(RtpRtcpAudioTest, DTMF) { |
285 CodecInst voice_codec; | 212 CodecInst voice_codec; |
286 memset(&voice_codec, 0, sizeof(voice_codec)); | 213 memset(&voice_codec, 0, sizeof(voice_codec)); |
287 voice_codec.pltype = 96; | 214 voice_codec.pltype = 96; |
288 voice_codec.plfreq = 8000; | 215 voice_codec.plfreq = 8000; |
289 memcpy(voice_codec.plname, "PCMU", 5); | 216 memcpy(voice_codec.plname, "PCMU", 5); |
290 | 217 |
291 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); | 218 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); |
292 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( | 219 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( |
293 voice_codec.plname, | 220 voice_codec.plname, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, | 274 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, |
348 timeStamp, -1, test, 4, nullptr, | 275 timeStamp, -1, test, 4, nullptr, |
349 nullptr, nullptr)); | 276 nullptr, nullptr)); |
350 fake_clock.AdvanceTimeMilliseconds(20); | 277 fake_clock.AdvanceTimeMilliseconds(20); |
351 module1->Process(); | 278 module1->Process(); |
352 } | 279 } |
353 } | 280 } |
354 | 281 |
355 } // namespace | 282 } // namespace |
356 } // namespace webrtc | 283 } // namespace webrtc |
OLD | NEW |