OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h" | 13 #include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h" |
14 #include "webrtc/modules/audio_coding/codecs/opus/opus_inst.h" | 14 #include "webrtc/modules/audio_coding/codecs/opus/opus_inst.h" |
15 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" | 15 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" |
16 #include "webrtc/test/testsupport/fileutils.h" | 16 #include "webrtc/test/testsupport/fileutils.h" |
17 #include "webrtc/test/testsupport/gtest_disable.h" | |
18 | 17 |
19 namespace webrtc { | 18 namespace webrtc { |
20 | 19 |
21 using test::AudioLoop; | 20 using test::AudioLoop; |
22 using ::testing::TestWithParam; | 21 using ::testing::TestWithParam; |
23 using ::testing::Values; | 22 using ::testing::Values; |
24 using ::testing::Combine; | 23 using ::testing::Combine; |
25 | 24 |
26 // Maximum number of bytes in output bitstream. | 25 // Maximum number of bytes in output bitstream. |
27 const size_t kMaxBytes = 1000; | 26 const size_t kMaxBytes = 1000; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 239 } |
241 | 240 |
242 // Free memory. | 241 // Free memory. |
243 delete[] output_data_decode; | 242 delete[] output_data_decode; |
244 delete[] silence; | 243 delete[] silence; |
245 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 244 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
246 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 245 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
247 } | 246 } |
248 | 247 |
249 // Test failing Create. | 248 // Test failing Create. |
250 TEST(OpusTest, DISABLED_ON_IOS(OpusCreateFail)) { | 249 TEST(OpusTest, OpusCreateFail) { |
251 WebRtcOpusEncInst* opus_encoder; | 250 WebRtcOpusEncInst* opus_encoder; |
252 WebRtcOpusDecInst* opus_decoder; | 251 WebRtcOpusDecInst* opus_decoder; |
253 | 252 |
254 // Test to see that an invalid pointer is caught. | 253 // Test to see that an invalid pointer is caught. |
255 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(NULL, 1, 0)); | 254 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(NULL, 1, 0)); |
256 // Invalid channel number. | 255 // Invalid channel number. |
257 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(&opus_encoder, 3, 0)); | 256 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(&opus_encoder, 3, 0)); |
258 // Invalid applciation mode. | 257 // Invalid applciation mode. |
259 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(&opus_encoder, 1, 2)); | 258 EXPECT_EQ(-1, WebRtcOpus_EncoderCreate(&opus_encoder, 1, 2)); |
260 | 259 |
261 EXPECT_EQ(-1, WebRtcOpus_DecoderCreate(NULL, 1)); | 260 EXPECT_EQ(-1, WebRtcOpus_DecoderCreate(NULL, 1)); |
262 // Invalid channel number. | 261 // Invalid channel number. |
263 EXPECT_EQ(-1, WebRtcOpus_DecoderCreate(&opus_decoder, 3)); | 262 EXPECT_EQ(-1, WebRtcOpus_DecoderCreate(&opus_decoder, 3)); |
264 } | 263 } |
265 | 264 |
266 // Test failing Free. | 265 // Test failing Free. |
267 TEST(OpusTest, DISABLED_ON_IOS(OpusFreeFail)) { | 266 TEST(OpusTest, OpusFreeFail) { |
268 // Test to see that an invalid pointer is caught. | 267 // Test to see that an invalid pointer is caught. |
269 EXPECT_EQ(-1, WebRtcOpus_EncoderFree(NULL)); | 268 EXPECT_EQ(-1, WebRtcOpus_EncoderFree(NULL)); |
270 EXPECT_EQ(-1, WebRtcOpus_DecoderFree(NULL)); | 269 EXPECT_EQ(-1, WebRtcOpus_DecoderFree(NULL)); |
271 } | 270 } |
272 | 271 |
273 // Test normal Create and Free. | 272 // Test normal Create and Free. |
274 TEST_P(OpusTest, DISABLED_ON_IOS(OpusCreateFree)) { | 273 TEST_P(OpusTest, OpusCreateFree) { |
275 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 274 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
276 channels_, | 275 channels_, |
277 application_)); | 276 application_)); |
278 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); | 277 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); |
279 EXPECT_TRUE(opus_encoder_ != NULL); | 278 EXPECT_TRUE(opus_encoder_ != NULL); |
280 EXPECT_TRUE(opus_decoder_ != NULL); | 279 EXPECT_TRUE(opus_decoder_ != NULL); |
281 // Free encoder and decoder memory. | 280 // Free encoder and decoder memory. |
282 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 281 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
283 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 282 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
284 } | 283 } |
285 | 284 |
286 TEST_P(OpusTest, DISABLED_ON_IOS(OpusEncodeDecode)) { | 285 TEST_P(OpusTest, OpusEncodeDecode) { |
287 PrepareSpeechData(channels_, 20, 20); | 286 PrepareSpeechData(channels_, 20, 20); |
288 | 287 |
289 // Create encoder memory. | 288 // Create encoder memory. |
290 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 289 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
291 channels_, | 290 channels_, |
292 application_)); | 291 application_)); |
293 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, | 292 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, |
294 channels_)); | 293 channels_)); |
295 | 294 |
296 // Set bitrate. | 295 // Set bitrate. |
(...skipping 17 matching lines...) Expand all Loading... |
314 EncodeDecode(opus_encoder_, speech_data_.GetNextBlock(), | 313 EncodeDecode(opus_encoder_, speech_data_.GetNextBlock(), |
315 kOpus20msFrameSamples, opus_decoder_, | 314 kOpus20msFrameSamples, opus_decoder_, |
316 output_data_decode, &audio_type)); | 315 output_data_decode, &audio_type)); |
317 | 316 |
318 // Free memory. | 317 // Free memory. |
319 delete[] output_data_decode; | 318 delete[] output_data_decode; |
320 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 319 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
321 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 320 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
322 } | 321 } |
323 | 322 |
324 TEST_P(OpusTest, DISABLED_ON_IOS(OpusSetBitRate)) { | 323 TEST_P(OpusTest, OpusSetBitRate) { |
325 // Test without creating encoder memory. | 324 // Test without creating encoder memory. |
326 EXPECT_EQ(-1, WebRtcOpus_SetBitRate(opus_encoder_, 60000)); | 325 EXPECT_EQ(-1, WebRtcOpus_SetBitRate(opus_encoder_, 60000)); |
327 | 326 |
328 // Create encoder memory, try with different bitrates. | 327 // Create encoder memory, try with different bitrates. |
329 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 328 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
330 channels_, | 329 channels_, |
331 application_)); | 330 application_)); |
332 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 30000)); | 331 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 30000)); |
333 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 60000)); | 332 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 60000)); |
334 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 300000)); | 333 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, 300000)); |
(...skipping 15 matching lines...) Expand all Loading... |
350 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 0)); | 349 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 0)); |
351 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 10)); | 350 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 10)); |
352 EXPECT_EQ(-1, WebRtcOpus_SetComplexity(opus_encoder_, 11)); | 351 EXPECT_EQ(-1, WebRtcOpus_SetComplexity(opus_encoder_, 11)); |
353 | 352 |
354 // Free memory. | 353 // Free memory. |
355 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 354 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
356 } | 355 } |
357 | 356 |
358 // Encode and decode one frame, initialize the decoder and | 357 // Encode and decode one frame, initialize the decoder and |
359 // decode once more. | 358 // decode once more. |
360 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDecodeInit)) { | 359 TEST_P(OpusTest, OpusDecodeInit) { |
361 PrepareSpeechData(channels_, 20, 20); | 360 PrepareSpeechData(channels_, 20, 20); |
362 | 361 |
363 // Create encoder memory. | 362 // Create encoder memory. |
364 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 363 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
365 channels_, | 364 channels_, |
366 application_)); | 365 application_)); |
367 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); | 366 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); |
368 | 367 |
369 // Encode & decode. | 368 // Encode & decode. |
370 int16_t audio_type; | 369 int16_t audio_type; |
371 int16_t* output_data_decode = new int16_t[kOpus20msFrameSamples * channels_]; | 370 int16_t* output_data_decode = new int16_t[kOpus20msFrameSamples * channels_]; |
372 EXPECT_EQ(kOpus20msFrameSamples, | 371 EXPECT_EQ(kOpus20msFrameSamples, |
373 EncodeDecode(opus_encoder_, speech_data_.GetNextBlock(), | 372 EncodeDecode(opus_encoder_, speech_data_.GetNextBlock(), |
374 kOpus20msFrameSamples, opus_decoder_, | 373 kOpus20msFrameSamples, opus_decoder_, |
375 output_data_decode, &audio_type)); | 374 output_data_decode, &audio_type)); |
376 | 375 |
377 EXPECT_EQ(0, WebRtcOpus_DecoderInit(opus_decoder_)); | 376 EXPECT_EQ(0, WebRtcOpus_DecoderInit(opus_decoder_)); |
378 | 377 |
379 EXPECT_EQ(kOpus20msFrameSamples, | 378 EXPECT_EQ(kOpus20msFrameSamples, |
380 WebRtcOpus_Decode(opus_decoder_, bitstream_, | 379 WebRtcOpus_Decode(opus_decoder_, bitstream_, |
381 encoded_bytes_, output_data_decode, | 380 encoded_bytes_, output_data_decode, |
382 &audio_type)); | 381 &audio_type)); |
383 | 382 |
384 // Free memory. | 383 // Free memory. |
385 delete[] output_data_decode; | 384 delete[] output_data_decode; |
386 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 385 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
387 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 386 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
388 } | 387 } |
389 | 388 |
390 TEST_P(OpusTest, DISABLED_ON_IOS(OpusEnableDisableFec)) { | 389 TEST_P(OpusTest, OpusEnableDisableFec) { |
391 // Test without creating encoder memory. | 390 // Test without creating encoder memory. |
392 EXPECT_EQ(-1, WebRtcOpus_EnableFec(opus_encoder_)); | 391 EXPECT_EQ(-1, WebRtcOpus_EnableFec(opus_encoder_)); |
393 EXPECT_EQ(-1, WebRtcOpus_DisableFec(opus_encoder_)); | 392 EXPECT_EQ(-1, WebRtcOpus_DisableFec(opus_encoder_)); |
394 | 393 |
395 // Create encoder memory. | 394 // Create encoder memory. |
396 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 395 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
397 channels_, | 396 channels_, |
398 application_)); | 397 application_)); |
399 | 398 |
400 EXPECT_EQ(0, WebRtcOpus_EnableFec(opus_encoder_)); | 399 EXPECT_EQ(0, WebRtcOpus_EnableFec(opus_encoder_)); |
401 EXPECT_EQ(0, WebRtcOpus_DisableFec(opus_encoder_)); | 400 EXPECT_EQ(0, WebRtcOpus_DisableFec(opus_encoder_)); |
402 | 401 |
403 // Free memory. | 402 // Free memory. |
404 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 403 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
405 } | 404 } |
406 | 405 |
407 TEST_P(OpusTest, DISABLED_ON_IOS(OpusEnableDisableDtx)) { | 406 TEST_P(OpusTest, OpusEnableDisableDtx) { |
408 // Test without creating encoder memory. | 407 // Test without creating encoder memory. |
409 EXPECT_EQ(-1, WebRtcOpus_EnableDtx(opus_encoder_)); | 408 EXPECT_EQ(-1, WebRtcOpus_EnableDtx(opus_encoder_)); |
410 EXPECT_EQ(-1, WebRtcOpus_DisableDtx(opus_encoder_)); | 409 EXPECT_EQ(-1, WebRtcOpus_DisableDtx(opus_encoder_)); |
411 | 410 |
412 // Create encoder memory. | 411 // Create encoder memory. |
413 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 412 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
414 channels_, | 413 channels_, |
415 application_)); | 414 application_)); |
416 | 415 |
417 opus_int32 dtx; | 416 opus_int32 dtx; |
(...skipping 13 matching lines...) Expand all Loading... |
431 EXPECT_EQ(0, WebRtcOpus_DisableDtx(opus_encoder_)); | 430 EXPECT_EQ(0, WebRtcOpus_DisableDtx(opus_encoder_)); |
432 opus_encoder_ctl(opus_encoder_->encoder, | 431 opus_encoder_ctl(opus_encoder_->encoder, |
433 OPUS_GET_DTX(&dtx)); | 432 OPUS_GET_DTX(&dtx)); |
434 EXPECT_EQ(0, dtx); | 433 EXPECT_EQ(0, dtx); |
435 | 434 |
436 | 435 |
437 // Free memory. | 436 // Free memory. |
438 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 437 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
439 } | 438 } |
440 | 439 |
441 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDtxOff)) { | 440 TEST_P(OpusTest, OpusDtxOff) { |
442 TestDtxEffect(false); | 441 TestDtxEffect(false); |
443 } | 442 } |
444 | 443 |
445 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDtxOn)) { | 444 TEST_P(OpusTest, OpusDtxOn) { |
446 TestDtxEffect(true); | 445 TestDtxEffect(true); |
447 } | 446 } |
448 | 447 |
449 TEST_P(OpusTest, DISABLED_ON_IOS(OpusSetPacketLossRate)) { | 448 TEST_P(OpusTest, OpusSetPacketLossRate) { |
450 // Test without creating encoder memory. | 449 // Test without creating encoder memory. |
451 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50)); | 450 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50)); |
452 | 451 |
453 // Create encoder memory. | 452 // Create encoder memory. |
454 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 453 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
455 channels_, | 454 channels_, |
456 application_)); | 455 application_)); |
457 | 456 |
458 EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50)); | 457 EXPECT_EQ(0, WebRtcOpus_SetPacketLossRate(opus_encoder_, 50)); |
459 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, -1)); | 458 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, -1)); |
460 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, 101)); | 459 EXPECT_EQ(-1, WebRtcOpus_SetPacketLossRate(opus_encoder_, 101)); |
461 | 460 |
462 // Free memory. | 461 // Free memory. |
463 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 462 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
464 } | 463 } |
465 | 464 |
466 TEST_P(OpusTest, DISABLED_ON_IOS(OpusSetMaxPlaybackRate)) { | 465 TEST_P(OpusTest, OpusSetMaxPlaybackRate) { |
467 // Test without creating encoder memory. | 466 // Test without creating encoder memory. |
468 EXPECT_EQ(-1, WebRtcOpus_SetMaxPlaybackRate(opus_encoder_, 20000)); | 467 EXPECT_EQ(-1, WebRtcOpus_SetMaxPlaybackRate(opus_encoder_, 20000)); |
469 | 468 |
470 // Create encoder memory. | 469 // Create encoder memory. |
471 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 470 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
472 channels_, | 471 channels_, |
473 application_)); | 472 application_)); |
474 | 473 |
475 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 48000); | 474 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 48000); |
476 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 24001); | 475 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_FULLBAND, 24001); |
477 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_SUPERWIDEBAND, 24000); | 476 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_SUPERWIDEBAND, 24000); |
478 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_SUPERWIDEBAND, 16001); | 477 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_SUPERWIDEBAND, 16001); |
479 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_WIDEBAND, 16000); | 478 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_WIDEBAND, 16000); |
480 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_WIDEBAND, 12001); | 479 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_WIDEBAND, 12001); |
481 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_MEDIUMBAND, 12000); | 480 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_MEDIUMBAND, 12000); |
482 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_MEDIUMBAND, 8001); | 481 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_MEDIUMBAND, 8001); |
483 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_NARROWBAND, 8000); | 482 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_NARROWBAND, 8000); |
484 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_NARROWBAND, 4000); | 483 SetMaxPlaybackRate(opus_encoder_, OPUS_BANDWIDTH_NARROWBAND, 4000); |
485 | 484 |
486 // Free memory. | 485 // Free memory. |
487 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 486 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
488 } | 487 } |
489 | 488 |
490 // Test PLC. | 489 // Test PLC. |
491 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDecodePlc)) { | 490 TEST_P(OpusTest, OpusDecodePlc) { |
492 PrepareSpeechData(channels_, 20, 20); | 491 PrepareSpeechData(channels_, 20, 20); |
493 | 492 |
494 // Create encoder memory. | 493 // Create encoder memory. |
495 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 494 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
496 channels_, | 495 channels_, |
497 application_)); | 496 application_)); |
498 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); | 497 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); |
499 | 498 |
500 // Set bitrate. | 499 // Set bitrate. |
501 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, | 500 EXPECT_EQ(0, WebRtcOpus_SetBitRate(opus_encoder_, |
(...skipping 16 matching lines...) Expand all Loading... |
518 WebRtcOpus_DecodePlc(opus_decoder_, plc_buffer, 1)); | 517 WebRtcOpus_DecodePlc(opus_decoder_, plc_buffer, 1)); |
519 | 518 |
520 // Free memory. | 519 // Free memory. |
521 delete[] plc_buffer; | 520 delete[] plc_buffer; |
522 delete[] output_data_decode; | 521 delete[] output_data_decode; |
523 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 522 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
524 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 523 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
525 } | 524 } |
526 | 525 |
527 // Duration estimation. | 526 // Duration estimation. |
528 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDurationEstimation)) { | 527 TEST_P(OpusTest, OpusDurationEstimation) { |
529 PrepareSpeechData(channels_, 20, 20); | 528 PrepareSpeechData(channels_, 20, 20); |
530 | 529 |
531 // Create. | 530 // Create. |
532 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 531 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
533 channels_, | 532 channels_, |
534 application_)); | 533 application_)); |
535 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); | 534 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); |
536 | 535 |
537 // 10 ms. We use only first 10 ms of a 20 ms block. | 536 // 10 ms. We use only first 10 ms of a 20 ms block. |
538 encoded_bytes_ = WebRtcOpus_Encode(opus_encoder_, | 537 encoded_bytes_ = WebRtcOpus_Encode(opus_encoder_, |
(...skipping 11 matching lines...) Expand all Loading... |
550 bitstream_); | 549 bitstream_); |
551 EXPECT_EQ(kOpus20msFrameSamples, | 550 EXPECT_EQ(kOpus20msFrameSamples, |
552 WebRtcOpus_DurationEst(opus_decoder_, bitstream_, | 551 WebRtcOpus_DurationEst(opus_decoder_, bitstream_, |
553 encoded_bytes_)); | 552 encoded_bytes_)); |
554 | 553 |
555 // Free memory. | 554 // Free memory. |
556 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 555 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
557 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 556 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
558 } | 557 } |
559 | 558 |
560 TEST_P(OpusTest, DISABLED_ON_IOS(OpusDecodeRepacketized)) { | 559 TEST_P(OpusTest, OpusDecodeRepacketized) { |
561 const int kPackets = 6; | 560 const int kPackets = 6; |
562 | 561 |
563 PrepareSpeechData(channels_, 20, 20 * kPackets); | 562 PrepareSpeechData(channels_, 20, 20 * kPackets); |
564 | 563 |
565 // Create encoder memory. | 564 // Create encoder memory. |
566 ASSERT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, | 565 ASSERT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, |
567 channels_, | 566 channels_, |
568 application_)); | 567 application_)); |
569 ASSERT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, | 568 ASSERT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, |
570 channels_)); | 569 channels_)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); | 603 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
605 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); | 604 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); |
606 } | 605 } |
607 | 606 |
608 INSTANTIATE_TEST_CASE_P(VariousMode, | 607 INSTANTIATE_TEST_CASE_P(VariousMode, |
609 OpusTest, | 608 OpusTest, |
610 Combine(Values(1, 2), Values(0, 1))); | 609 Combine(Values(1, 2), Values(0, 1))); |
611 | 610 |
612 | 611 |
613 } // namespace webrtc | 612 } // namespace webrtc |
OLD | NEW |