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

Side by Side Diff: webrtc/test/mock_voice_engine.h

Issue 2948763002: Allow an external audio processing module to be used in WebRTC (Closed)
Patch Set: tracking linux32_rel issue Created 3 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) 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 #ifndef WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ 11 #ifndef WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
12 #define WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ 12 #define WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
13 13
14 #include <memory> 14 #include <memory>
15 15
16 #include "webrtc/modules/audio_device/include/mock_audio_device.h" 16 #include "webrtc/modules/audio_device/include/mock_audio_device.h"
17 #include "webrtc/modules/audio_device/include/mock_audio_transport.h" 17 #include "webrtc/modules/audio_device/include/mock_audio_transport.h"
18 #include "webrtc/modules/audio_processing/include/mock_audio_processing.h"
19 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h" 18 #include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h"
20 #include "webrtc/test/gmock.h" 19 #include "webrtc/test/gmock.h"
21 #include "webrtc/test/mock_voe_channel_proxy.h" 20 #include "webrtc/test/mock_voe_channel_proxy.h"
22 #include "webrtc/voice_engine/voice_engine_impl.h" 21 #include "webrtc/voice_engine/voice_engine_impl.h"
23 22
24 namespace webrtc { 23 namespace webrtc {
25 namespace voe { 24 namespace voe {
26 class TransmitMixer; 25 class TransmitMixer;
27 } // namespace voe 26 } // namespace voe
28 27
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 EXPECT_CALL(*proxy, GetRtpRtcp(testing::_, testing::_)) 60 EXPECT_CALL(*proxy, GetRtpRtcp(testing::_, testing::_))
62 .WillRepeatedly( 61 .WillRepeatedly(
63 testing::SetArgPointee<0>(GetMockRtpRtcp(channel_id))); 62 testing::SetArgPointee<0>(GetMockRtpRtcp(channel_id)));
64 return proxy; 63 return proxy;
65 })); 64 }));
66 65
67 ON_CALL(mock_audio_device_, TimeUntilNextProcess()) 66 ON_CALL(mock_audio_device_, TimeUntilNextProcess())
68 .WillByDefault(testing::Return(1000)); 67 .WillByDefault(testing::Return(1000));
69 ON_CALL(*this, audio_device_module()) 68 ON_CALL(*this, audio_device_module())
70 .WillByDefault(testing::Return(&mock_audio_device_)); 69 .WillByDefault(testing::Return(&mock_audio_device_));
71 ON_CALL(*this, audio_processing())
72 .WillByDefault(testing::Return(&mock_audio_processing_));
73 ON_CALL(*this, audio_transport()) 70 ON_CALL(*this, audio_transport())
74 .WillByDefault(testing::Return(&mock_audio_transport_)); 71 .WillByDefault(testing::Return(&mock_audio_transport_));
75 } 72 }
76 virtual ~MockVoiceEngine() /* override */ { 73 virtual ~MockVoiceEngine() /* override */ {
77 // Decrease ref count before base class d-tor is called; otherwise it will 74 // Decrease ref count before base class d-tor is called; otherwise it will
78 // trigger an assertion. 75 // trigger an assertion.
79 --_ref_count; 76 --_ref_count;
80 } 77 }
81 78
82 // These need to be the same each call to channel_id and must not leak. 79 // These need to be the same each call to channel_id and must not leak.
(...skipping 12 matching lines...) Expand all
95 int channel_id) /* override */ { 92 int channel_id) /* override */ {
96 return std::unique_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id)); 93 return std::unique_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id));
97 } 94 }
98 95
99 // VoEBase 96 // VoEBase
100 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer)); 97 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer));
101 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int()); 98 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int());
102 MOCK_METHOD3( 99 MOCK_METHOD3(
103 Init, 100 Init,
104 int(AudioDeviceModule* external_adm, 101 int(AudioDeviceModule* external_adm,
105 AudioProcessing* audioproc, 102 AudioProcessing* external_apm,
106 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)); 103 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory));
107 MOCK_METHOD0(audio_processing, AudioProcessing*());
108 MOCK_METHOD0(audio_device_module, AudioDeviceModule*()); 104 MOCK_METHOD0(audio_device_module, AudioDeviceModule*());
109 MOCK_METHOD0(transmit_mixer, voe::TransmitMixer*()); 105 MOCK_METHOD0(transmit_mixer, voe::TransmitMixer*());
110 MOCK_METHOD0(Terminate, int()); 106 MOCK_METHOD0(Terminate, int());
111 MOCK_METHOD0(CreateChannel, int()); 107 MOCK_METHOD0(CreateChannel, int());
112 MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config)); 108 MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config));
113 MOCK_METHOD1(DeleteChannel, int(int channel)); 109 MOCK_METHOD1(DeleteChannel, int(int channel));
114 MOCK_METHOD1(StartReceive, int(int channel)); 110 MOCK_METHOD1(StartReceive, int(int channel));
115 MOCK_METHOD1(StopReceive, int(int channel)); 111 MOCK_METHOD1(StopReceive, int(int channel));
116 MOCK_METHOD1(StartPlayout, int(int channel)); 112 MOCK_METHOD1(StartPlayout, int(int channel));
117 MOCK_METHOD1(StopPlayout, int(int channel)); 113 MOCK_METHOD1(StopPlayout, int(int channel));
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // here, but due to how gmock is implemented, I cannot just keep it in the 246 // here, but due to how gmock is implemented, I cannot just keep it in the
251 // functor implementing the default version of ChannelProxyFactory, above. 247 // functor implementing the default version of ChannelProxyFactory, above.
252 // GMock creates an unfortunate copy of the functor, which would cause us to 248 // GMock creates an unfortunate copy of the functor, which would cause us to
253 // return a dangling reference. Fortunately, this should go away once 249 // return a dangling reference. Fortunately, this should go away once
254 // voe::Channel does. 250 // voe::Channel does.
255 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; 251 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
256 252
257 std::map<int, std::unique_ptr<MockRtpRtcp>> mock_rtp_rtcps_; 253 std::map<int, std::unique_ptr<MockRtpRtcp>> mock_rtp_rtcps_;
258 254
259 MockAudioDeviceModule mock_audio_device_; 255 MockAudioDeviceModule mock_audio_device_;
260 MockAudioProcessing mock_audio_processing_;
261 MockAudioTransport mock_audio_transport_; 256 MockAudioTransport mock_audio_transport_;
262 }; 257 };
263 } // namespace test 258 } // namespace test
264 } // namespace webrtc 259 } // namespace webrtc
265 260
266 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ 261 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698