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

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine_unittest.cc

Issue 2062193002: Add AudioReceiveStream::SetGain() method and use that in WVoMC::SetOutputVolume(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: misc Created 4 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) 2008 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2008 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 3121 matching lines...) Expand 10 before | Expand all | Expand 10 after
3132 int channel_id2 = voe_.GetLastChannel(); 3132 int channel_id2 = voe_.GetLastChannel();
3133 EXPECT_EQ(channel_id2, media_channel->GetSendChannelId(kSsrc2)); 3133 EXPECT_EQ(channel_id2, media_channel->GetSendChannelId(kSsrc2));
3134 } 3134 }
3135 3135
3136 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) { 3136 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) {
3137 EXPECT_TRUE(SetupChannel()); 3137 EXPECT_TRUE(SetupChannel());
3138 EXPECT_FALSE(channel_->SetOutputVolume(kSsrc2, 0.5)); 3138 EXPECT_FALSE(channel_->SetOutputVolume(kSsrc2, 0.5));
3139 cricket::StreamParams stream; 3139 cricket::StreamParams stream;
3140 stream.ssrcs.push_back(kSsrc2); 3140 stream.ssrcs.push_back(kSsrc2);
3141 EXPECT_TRUE(channel_->AddRecvStream(stream)); 3141 EXPECT_TRUE(channel_->AddRecvStream(stream));
3142 int channel_id = voe_.GetLastChannel();
3143 EXPECT_TRUE(channel_->SetOutputVolume(kSsrc2, 3)); 3142 EXPECT_TRUE(channel_->SetOutputVolume(kSsrc2, 3));
3144 float scale = 0; 3143 EXPECT_DOUBLE_EQ(3, GetRecvStream(kSsrc2).gain());
kwiberg-webrtc 2016/06/16 09:26:53 Add an EXPECT_ to test the value of .gain() before
the sun 2016/06/16 14:34:06 Done.
3145 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
3146 EXPECT_DOUBLE_EQ(3, scale);
3147 } 3144 }
3148 3145
3149 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolumeDefaultRecvStream) { 3146 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolumeDefaultRecvStream) {
3150 EXPECT_TRUE(SetupChannel()); 3147 EXPECT_TRUE(SetupChannel());
3151 EXPECT_TRUE(channel_->SetOutputVolume(0, 2)); 3148 EXPECT_TRUE(channel_->SetOutputVolume(0, 2));
3152 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 3149 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
3153 int channel_id = voe_.GetLastChannel(); 3150 EXPECT_DOUBLE_EQ(2, GetRecvStream(1).gain());
3154 float scale = 0;
3155 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
3156 EXPECT_DOUBLE_EQ(2, scale);
3157 EXPECT_TRUE(channel_->SetOutputVolume(0, 3)); 3151 EXPECT_TRUE(channel_->SetOutputVolume(0, 3));
3158 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale)); 3152 EXPECT_DOUBLE_EQ(3, GetRecvStream(1).gain());
3159 EXPECT_DOUBLE_EQ(3, scale);
3160 } 3153 }
3161 3154
3162 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) { 3155 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) {
3163 const uint32_t kAudioSsrc = 123; 3156 const uint32_t kAudioSsrc = 123;
3164 const std::string kSyncLabel = "AvSyncLabel"; 3157 const std::string kSyncLabel = "AvSyncLabel";
3165 3158
3166 EXPECT_TRUE(SetupSendStream()); 3159 EXPECT_TRUE(SetupSendStream());
3167 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kAudioSsrc); 3160 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kAudioSsrc);
3168 sp.sync_label = kSyncLabel; 3161 sp.sync_label = kSyncLabel;
3169 // Creating two channels to make sure that sync label is set properly for both 3162 // Creating two channels to make sure that sync label is set properly for both
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 cricket::WebRtcVoiceEngine engine( 3526 cricket::WebRtcVoiceEngine engine(
3534 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); 3527 nullptr, webrtc::CreateBuiltinAudioDecoderFactory());
3535 std::unique_ptr<webrtc::Call> call( 3528 std::unique_ptr<webrtc::Call> call(
3536 webrtc::Call::Create(webrtc::Call::Config())); 3529 webrtc::Call::Create(webrtc::Call::Config()));
3537 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3530 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3538 cricket::AudioOptions(), call.get()); 3531 cricket::AudioOptions(), call.get());
3539 cricket::AudioRecvParameters parameters; 3532 cricket::AudioRecvParameters parameters;
3540 parameters.codecs = engine.recv_codecs(); 3533 parameters.codecs = engine.recv_codecs();
3541 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3534 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3542 } 3535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698