Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc

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

Powered by Google App Engine
This is Rietveld 408576698