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

Side by Side Diff: webrtc/audio/audio_receive_stream_unittest.cc

Issue 2961723004: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: Moved creation of APMs from CreateVoiceEngines Created 3 years, 5 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/api/peerconnectioninterface.h ('k') | webrtc/audio/audio_send_stream.cc » ('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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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
11 #include <map> 11 #include <map>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "webrtc/api/test/mock_audio_mixer.h" 15 #include "webrtc/api/test/mock_audio_mixer.h"
16 #include "webrtc/audio/audio_receive_stream.h" 16 #include "webrtc/audio/audio_receive_stream.h"
17 #include "webrtc/audio/conversion.h" 17 #include "webrtc/audio/conversion.h"
18 #include "webrtc/call/rtp_stream_receiver_controller.h" 18 #include "webrtc/call/rtp_stream_receiver_controller.h"
19 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 19 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
20 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
20 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" 21 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h"
21 #include "webrtc/modules/pacing/packet_router.h" 22 #include "webrtc/modules/pacing/packet_router.h"
22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h"
23 #include "webrtc/test/gtest.h" 24 #include "webrtc/test/gtest.h"
24 #include "webrtc/test/mock_audio_decoder_factory.h" 25 #include "webrtc/test/mock_audio_decoder_factory.h"
25 #include "webrtc/test/mock_voe_channel_proxy.h" 26 #include "webrtc/test/mock_voe_channel_proxy.h"
26 #include "webrtc/test/mock_voice_engine.h" 27 #include "webrtc/test/mock_voice_engine.h"
27 28
28 namespace webrtc { 29 namespace webrtc {
29 namespace test { 30 namespace test {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 struct ConfigHelper { 68 struct ConfigHelper {
68 ConfigHelper() 69 ConfigHelper()
69 : decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>), 70 : decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>),
70 audio_mixer_(new rtc::RefCountedObject<MockAudioMixer>()) { 71 audio_mixer_(new rtc::RefCountedObject<MockAudioMixer>()) {
71 using testing::Invoke; 72 using testing::Invoke;
72 73
73 EXPECT_CALL(voice_engine_, 74 EXPECT_CALL(voice_engine_,
74 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 75 RegisterVoiceEngineObserver(_)).WillOnce(Return(0));
75 EXPECT_CALL(voice_engine_, 76 EXPECT_CALL(voice_engine_,
76 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 77 DeRegisterVoiceEngineObserver()).WillOnce(Return(0));
77 EXPECT_CALL(voice_engine_, audio_processing());
78 EXPECT_CALL(voice_engine_, audio_device_module()); 78 EXPECT_CALL(voice_engine_, audio_device_module());
79 EXPECT_CALL(voice_engine_, audio_transport()); 79 EXPECT_CALL(voice_engine_, audio_transport());
80 80
81 AudioState::Config config; 81 AudioState::Config config;
82 config.voice_engine = &voice_engine_; 82 config.voice_engine = &voice_engine_;
83 config.audio_mixer = audio_mixer_; 83 config.audio_mixer = audio_mixer_;
84 config.audio_processing = new rtc::RefCountedObject<MockAudioProcessing>();
84 audio_state_ = AudioState::Create(config); 85 audio_state_ = AudioState::Create(config);
85 86
86 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) 87 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
87 .WillOnce(Invoke([this](int channel_id) { 88 .WillOnce(Invoke([this](int channel_id) {
88 EXPECT_FALSE(channel_proxy_); 89 EXPECT_FALSE(channel_proxy_);
89 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); 90 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>();
90 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); 91 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1);
91 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1); 92 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1);
92 EXPECT_CALL(*channel_proxy_, 93 EXPECT_CALL(*channel_proxy_,
93 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId)) 94 SetReceiveAudioLevelIndicationStatus(true, kAudioLevelId))
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 365
365 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0)); 366 EXPECT_CALL(helper.voice_engine(), StartPlayout(_)).WillOnce(Return(0));
366 EXPECT_CALL(helper.voice_engine(), StopPlayout(_)); 367 EXPECT_CALL(helper.voice_engine(), StopPlayout(_));
367 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream)) 368 EXPECT_CALL(*helper.audio_mixer(), AddSource(&recv_stream))
368 .WillOnce(Return(true)); 369 .WillOnce(Return(true));
369 370
370 recv_stream.Start(); 371 recv_stream.Start();
371 } 372 }
372 } // namespace test 373 } // namespace test
373 } // namespace webrtc 374 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/peerconnectioninterface.h ('k') | webrtc/audio/audio_send_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698