From de386bf67b76e48b9c0c58580938b91b644f42f8 Mon Sep 17 00:00:00 2001 From: "minyue@webrtc.org" Date: Thu, 30 Oct 2014 07:20:09 +0000 Subject: [PATCH] to submit git-svn-id: http://webrtc.googlecode.com/svn/trunk@7564 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../webrtc/webrtcvoiceengine_unittest.cc | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/talk/media/webrtc/webrtcvoiceengine_unittest.cc b/talk/media/webrtc/webrtcvoiceengine_unittest.cc index 7e38183c8..5deabd290 100644 --- a/talk/media/webrtc/webrtcvoiceengine_unittest.cc +++ b/talk/media/webrtc/webrtcvoiceengine_unittest.cc @@ -1254,9 +1254,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateNb) { webrtc::CodecInst gcodec; EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); EXPECT_STREQ("opus", gcodec.plname); - // TODO(minyue): Default bit rate is not but can in future be affected by - // kCodecParamMaxPlaybackRate. - EXPECT_EQ(32000, gcodec.rate); + + EXPECT_EQ(12000, gcodec.rate); + codecs[0].SetParam(cricket::kCodecParamStereo, "1"); + EXPECT_TRUE(channel_->SetSendCodecs(codecs)); + EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); + EXPECT_EQ(24000, gcodec.rate); } // Test 8000 < maxplaybackrate <= 12000 triggers Opus medium band mode. @@ -1273,9 +1276,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateMb) { webrtc::CodecInst gcodec; EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); EXPECT_STREQ("opus", gcodec.plname); - // TODO(minyue): Default bit rate is not but can in future be affected by - // kCodecParamMaxPlaybackRate. - EXPECT_EQ(32000, gcodec.rate); + + EXPECT_EQ(20000, gcodec.rate); + codecs[0].SetParam(cricket::kCodecParamStereo, "1"); + EXPECT_TRUE(channel_->SetSendCodecs(codecs)); + EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); + EXPECT_EQ(40000, gcodec.rate); } // Test 12000 < maxplaybackrate <= 16000 triggers Opus wide band mode. @@ -1292,9 +1298,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateWb) { webrtc::CodecInst gcodec; EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); EXPECT_STREQ("opus", gcodec.plname); - // TODO(minyue): Default bit rate is not but can in future be affected by - // kCodecParamMaxPlaybackRate. - EXPECT_EQ(32000, gcodec.rate); + + EXPECT_EQ(20000, gcodec.rate); + codecs[0].SetParam(cricket::kCodecParamStereo, "1"); + EXPECT_TRUE(channel_->SetSendCodecs(codecs)); + EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); + EXPECT_EQ(40000, gcodec.rate); } // Test 16000 < maxplaybackrate <= 24000 triggers Opus super wide band mode. @@ -1311,9 +1320,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateSwb) { webrtc::CodecInst gcodec; EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); EXPECT_STREQ("opus", gcodec.plname); - // TODO(minyue): Default bit rate is not but can in future be affected by - // kCodecParamMaxPlaybackRate. + EXPECT_EQ(32000, gcodec.rate); + codecs[0].SetParam(cricket::kCodecParamStereo, "1"); + EXPECT_TRUE(channel_->SetSendCodecs(codecs)); + EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); + EXPECT_EQ(64000, gcodec.rate); } // Test 24000 < maxplaybackrate triggers Opus full band mode. @@ -1330,9 +1342,12 @@ TEST_F(WebRtcVoiceEngineTestFake, SetOpusMaxPlaybackRateFb) { webrtc::CodecInst gcodec; EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); EXPECT_STREQ("opus", gcodec.plname); - // TODO(minyue): Default bit rate is not but can in future be affected by - // kCodecParamMaxPlaybackRate. + EXPECT_EQ(32000, gcodec.rate); + codecs[0].SetParam(cricket::kCodecParamStereo, "1"); + EXPECT_TRUE(channel_->SetSendCodecs(codecs)); + EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec)); + EXPECT_EQ(64000, gcodec.rate); } // Test Opus that without maxplaybackrate, default playback rate is used.