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

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: bad test 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
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | 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) 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 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3123 int channel_id2 = voe_.GetLastChannel(); 3123 int channel_id2 = voe_.GetLastChannel();
3124 EXPECT_EQ(channel_id2, media_channel->GetSendChannelId(kSsrc2)); 3124 EXPECT_EQ(channel_id2, media_channel->GetSendChannelId(kSsrc2));
3125 } 3125 }
3126 3126
3127 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) { 3127 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolume) {
3128 EXPECT_TRUE(SetupChannel()); 3128 EXPECT_TRUE(SetupChannel());
3129 EXPECT_FALSE(channel_->SetOutputVolume(kSsrc2, 0.5)); 3129 EXPECT_FALSE(channel_->SetOutputVolume(kSsrc2, 0.5));
3130 cricket::StreamParams stream; 3130 cricket::StreamParams stream;
3131 stream.ssrcs.push_back(kSsrc2); 3131 stream.ssrcs.push_back(kSsrc2);
3132 EXPECT_TRUE(channel_->AddRecvStream(stream)); 3132 EXPECT_TRUE(channel_->AddRecvStream(stream));
3133 int channel_id = voe_.GetLastChannel(); 3133 EXPECT_DOUBLE_EQ(1, GetRecvStream(kSsrc2).gain());
3134 EXPECT_TRUE(channel_->SetOutputVolume(kSsrc2, 3)); 3134 EXPECT_TRUE(channel_->SetOutputVolume(kSsrc2, 3));
3135 float scale = 0; 3135 EXPECT_DOUBLE_EQ(3, GetRecvStream(kSsrc2).gain());
3136 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
3137 EXPECT_DOUBLE_EQ(3, scale);
3138 } 3136 }
3139 3137
3140 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolumeDefaultRecvStream) { 3138 TEST_F(WebRtcVoiceEngineTestFake, SetOutputVolumeDefaultRecvStream) {
3141 EXPECT_TRUE(SetupChannel()); 3139 EXPECT_TRUE(SetupChannel());
3142 EXPECT_TRUE(channel_->SetOutputVolume(0, 2)); 3140 EXPECT_TRUE(channel_->SetOutputVolume(0, 2));
3143 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); 3141 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame));
3144 int channel_id = voe_.GetLastChannel(); 3142 EXPECT_DOUBLE_EQ(2, GetRecvStream(1).gain());
3145 float scale = 0;
3146 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale));
3147 EXPECT_DOUBLE_EQ(2, scale);
3148 EXPECT_TRUE(channel_->SetOutputVolume(0, 3)); 3143 EXPECT_TRUE(channel_->SetOutputVolume(0, 3));
3149 EXPECT_EQ(0, voe_.GetChannelOutputVolumeScaling(channel_id, scale)); 3144 EXPECT_DOUBLE_EQ(3, GetRecvStream(1).gain());
3150 EXPECT_DOUBLE_EQ(3, scale); 3145 EXPECT_TRUE(channel_->SetOutputVolume(1, 4));
3146 EXPECT_DOUBLE_EQ(4, GetRecvStream(1).gain());
3151 } 3147 }
3152 3148
3153 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) { 3149 TEST_F(WebRtcVoiceEngineTestFake, SetsSyncGroupFromSyncLabel) {
3154 const uint32_t kAudioSsrc = 123; 3150 const uint32_t kAudioSsrc = 123;
3155 const std::string kSyncLabel = "AvSyncLabel"; 3151 const std::string kSyncLabel = "AvSyncLabel";
3156 3152
3157 EXPECT_TRUE(SetupSendStream()); 3153 EXPECT_TRUE(SetupSendStream());
3158 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kAudioSsrc); 3154 cricket::StreamParams sp = cricket::StreamParams::CreateLegacy(kAudioSsrc);
3159 sp.sync_label = kSyncLabel; 3155 sp.sync_label = kSyncLabel;
3160 // Creating two channels to make sure that sync label is set properly for both 3156 // Creating two channels to make sure that sync label is set properly for both
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
3523 cricket::WebRtcVoiceEngine engine( 3519 cricket::WebRtcVoiceEngine engine(
3524 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); 3520 nullptr, webrtc::CreateBuiltinAudioDecoderFactory());
3525 std::unique_ptr<webrtc::Call> call( 3521 std::unique_ptr<webrtc::Call> call(
3526 webrtc::Call::Create(webrtc::Call::Config())); 3522 webrtc::Call::Create(webrtc::Call::Config()));
3527 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), 3523 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(),
3528 cricket::AudioOptions(), call.get()); 3524 cricket::AudioOptions(), call.get());
3529 cricket::AudioRecvParameters parameters; 3525 cricket::AudioRecvParameters parameters;
3530 parameters.codecs = engine.recv_codecs(); 3526 parameters.codecs = engine.recv_codecs();
3531 EXPECT_TRUE(channel.SetRecvParameters(parameters)); 3527 EXPECT_TRUE(channel.SetRecvParameters(parameters));
3532 } 3528 }
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.cc ('k') | webrtc/test/mock_voe_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698