Index: webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc |
diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc b/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc |
index c634885e525b1de8086d6d592438375786596423..84b27979b278a6c8b7987004d867699436268686 100644 |
--- a/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc |
+++ b/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc |
@@ -409,6 +409,27 @@ TEST_P(OpusTest, OpusSetComplexity) { |
EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
} |
+TEST_P(OpusTest, OpusForceChannels) { |
+ // Test without creating encoder memory. |
+ EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 1)); |
+ |
+ ASSERT_EQ(0, |
+ WebRtcOpus_EncoderCreate(&opus_encoder_, channels_, application_)); |
+ |
+ if (channels_ == 2) { |
+ EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 3)); |
+ EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 2)); |
+ EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 1)); |
+ EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 0)); |
+ } else { |
+ EXPECT_EQ(-1, WebRtcOpus_SetForceChannels(opus_encoder_, 2)); |
+ EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 1)); |
+ EXPECT_EQ(0, WebRtcOpus_SetForceChannels(opus_encoder_, 0)); |
+ } |
+ |
+ EXPECT_EQ(0, WebRtcOpus_EncoderFree(opus_encoder_)); |
+} |
+ |
// Encode and decode one frame, initialize the decoder and |
// decode once more. |
TEST_P(OpusTest, OpusDecodeInit) { |