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

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

Issue 2352713005: Posting Opus's set-force-channels functionality to WebRTC. (Closed)
Patch Set: clarify comment Created 4 years, 2 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
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_interface.c ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 application_)); 402 application_));
403 403
404 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 0)); 404 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 0));
405 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 10)); 405 EXPECT_EQ(0, WebRtcOpus_SetComplexity(opus_encoder_, 10));
406 EXPECT_EQ(-1, WebRtcOpus_SetComplexity(opus_encoder_, 11)); 406 EXPECT_EQ(-1, WebRtcOpus_SetComplexity(opus_encoder_, 11));
407 407
408 // Free memory. 408 // Free memory.
409 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); 409 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_));
410 } 410 }
411 411
412 TEST_P(OpusTest, OpusForceChannels) {
413 // Test without creating encoder memory.
414 EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 1));
415
416 ASSERT_EQ(0,
417 WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_));
418
419 if (channels_ == 2) {
420 EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 3));
421 EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 2));
422 EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 1));
423 EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 0));
424 } else {
425 EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 2));
426 EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 1));
427 EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 0));
428 }
429
430 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_));
431 }
432
412 // Encode and decode one frame, initialize the decoder and 433 // Encode and decode one frame, initialize the decoder and
413 // decode once more. 434 // decode once more.
414 TEST_P(OpusTest, OpusDecodeInit) { 435 TEST_P(OpusTest, OpusDecodeInit) {
415 PrepareSpeechData(channels_, 20, 20); 436 PrepareSpeechData(channels_, 20, 20);
416 437
417 // Create encoder memory. 438 // Create encoder memory.
418 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_, 439 EXPECT_EQ(0, WebRtcOpus_EncoderCreate(&opus_encoder_,
419 channels_, 440 channels_,
420 application_)); 441 application_));
421 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_)); 442 EXPECT_EQ(0, WebRtcOpus_DecoderCreate(&opus_decoder_, channels_));
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); 693 EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_));
673 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_)); 694 EXPECT_EQ(0, WebRtcOpus_DecoderFree(opus_decoder_));
674 } 695 }
675 696
676 INSTANTIATE_TEST_CASE_P(VariousMode, 697 INSTANTIATE_TEST_CASE_P(VariousMode,
677 OpusTest, 698 OpusTest,
678 Combine(Values(1, 2), Values(0, 1))); 699 Combine(Values(1, 2), Values(0, 1)));
679 700
680 701
681 } // namespace webrtc 702 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/codecs/opus/opus_interface.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698