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

Side by Side Diff: webrtc/media/engine/fakewebrtcvoiceengine.h

Issue 1830213002: Remove WVoE::SetAudioDeviceModule() - it is now set in ctor. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 8 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/base/mediaengine.h ('k') | webrtc/media/engine/nullwebrtcvideoengine_unittest.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) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ 11 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ 12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
13 13
14 #include <list> 14 #include <list>
15 #include <map> 15 #include <map>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/basictypes.h" 18 #include "webrtc/base/basictypes.h"
19 #include "webrtc/base/checks.h" 19 #include "webrtc/base/checks.h"
20 #include "webrtc/base/gunit.h" 20 #include "webrtc/base/gunit.h"
21 #include "webrtc/base/stringutils.h" 21 #include "webrtc/base/stringutils.h"
22 #include "webrtc/config.h" 22 #include "webrtc/config.h"
23 #include "webrtc/media/base/codec.h" 23 #include "webrtc/media/base/codec.h"
24 #include "webrtc/media/base/rtputils.h" 24 #include "webrtc/media/base/rtputils.h"
25 #include "webrtc/media/engine/fakewebrtccommon.h" 25 #include "webrtc/media/engine/fakewebrtccommon.h"
26 #include "webrtc/media/engine/webrtcvoe.h" 26 #include "webrtc/media/engine/webrtcvoe.h"
27 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" 27 #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
28 #include "webrtc/modules/audio_device/include/fake_audio_device.h"
28 #include "webrtc/modules/audio_processing/include/audio_processing.h" 29 #include "webrtc/modules/audio_processing/include/audio_processing.h"
29 30
30 namespace cricket { 31 namespace cricket {
31 32
32 static const int kOpusBandwidthNb = 4000; 33 static const int kOpusBandwidthNb = 4000;
33 static const int kOpusBandwidthMb = 6000; 34 static const int kOpusBandwidthMb = 6000;
34 static const int kOpusBandwidthWb = 8000; 35 static const int kOpusBandwidthWb = 8000;
35 static const int kOpusBandwidthSwb = 12000; 36 static const int kOpusBandwidthSwb = 12000;
36 static const int kOpusBandwidthFb = 20000; 37 static const int kOpusBandwidthFb = 20000;
37 38
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 webrtc::VoiceDetection* voice_detection() const override { return NULL; } 112 webrtc::VoiceDetection* voice_detection() const override { return NULL; }
112 113
113 bool experimental_ns_enabled() { 114 bool experimental_ns_enabled() {
114 return experimental_ns_enabled_; 115 return experimental_ns_enabled_;
115 } 116 }
116 117
117 private: 118 private:
118 bool experimental_ns_enabled_; 119 bool experimental_ns_enabled_;
119 }; 120 };
120 121
122 // TODO(solenberg): Swap this for a proper mock of the ADM.
123 class FakeAudioDeviceModule : public webrtc::FakeAudioDeviceModule {
124 public:
125 ~FakeAudioDeviceModule() override {
126 RTC_DCHECK_EQ(0, ref_count_);
127 }
128 int32_t AddRef() const override {
129 ref_count_++;
130 return ref_count_;
131 }
132 int32_t Release() const override {
133 RTC_DCHECK_LT(0, ref_count_);
134 ref_count_--;
135 return ref_count_;
136 }
137
138 private:
139 mutable int32_t ref_count_ = 0;
140 };
141
121 class FakeWebRtcVoiceEngine 142 class FakeWebRtcVoiceEngine
122 : public webrtc::VoEAudioProcessing, 143 : public webrtc::VoEAudioProcessing,
123 public webrtc::VoEBase, public webrtc::VoECodec, 144 public webrtc::VoEBase, public webrtc::VoECodec,
124 public webrtc::VoEHardware, 145 public webrtc::VoEHardware,
125 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP, 146 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
126 public webrtc::VoEVolumeControl { 147 public webrtc::VoEVolumeControl {
127 public: 148 public:
128 struct Channel { 149 struct Channel {
129 explicit Channel() 150 explicit Channel()
130 : external_transport(false), 151 : external_transport(false),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 ec_mode_(webrtc::kEcDefault), 207 ec_mode_(webrtc::kEcDefault),
187 aecm_mode_(webrtc::kAecmSpeakerphone), 208 aecm_mode_(webrtc::kAecmSpeakerphone),
188 ns_mode_(webrtc::kNsDefault), 209 ns_mode_(webrtc::kNsDefault),
189 agc_mode_(webrtc::kAgcDefault), 210 agc_mode_(webrtc::kAgcDefault),
190 observer_(NULL), 211 observer_(NULL),
191 playout_fail_channel_(-1), 212 playout_fail_channel_(-1),
192 recording_sample_rate_(-1), 213 recording_sample_rate_(-1),
193 playout_sample_rate_(-1) { 214 playout_sample_rate_(-1) {
194 memset(&agc_config_, 0, sizeof(agc_config_)); 215 memset(&agc_config_, 0, sizeof(agc_config_));
195 } 216 }
196 ~FakeWebRtcVoiceEngine() { 217 ~FakeWebRtcVoiceEngine() override {
197 RTC_CHECK(channels_.empty()); 218 RTC_CHECK(channels_.empty());
198 } 219 }
199 220
200 bool ec_metrics_enabled() const { return ec_metrics_enabled_; } 221 bool ec_metrics_enabled() const { return ec_metrics_enabled_; }
201 222
202 bool IsInited() const { return inited_; } 223 bool IsInited() const { return inited_; }
203 int GetLastChannel() const { return last_channel_; } 224 int GetLastChannel() const { return last_channel_; }
204 int GetNumChannels() const { return static_cast<int>(channels_.size()); } 225 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
205 uint32_t GetLocalSSRC(int channel) { 226 uint32_t GetLocalSSRC(int channel) {
206 return channels_[channel]->send_ssrc; 227 return channels_[channel]->send_ssrc;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 inited_ = true; 320 inited_ = true;
300 return 0; 321 return 0;
301 } 322 }
302 WEBRTC_FUNC(Terminate, ()) { 323 WEBRTC_FUNC(Terminate, ()) {
303 inited_ = false; 324 inited_ = false;
304 return 0; 325 return 0;
305 } 326 }
306 webrtc::AudioProcessing* audio_processing() override { 327 webrtc::AudioProcessing* audio_processing() override {
307 return &audio_processing_; 328 return &audio_processing_;
308 } 329 }
330 webrtc::AudioDeviceModule* audio_device_module() override {
331 return &audio_device_module_;
332 }
309 WEBRTC_FUNC(CreateChannel, ()) { 333 WEBRTC_FUNC(CreateChannel, ()) {
310 webrtc::Config empty_config; 334 webrtc::Config empty_config;
311 return AddChannel(empty_config); 335 return AddChannel(empty_config);
312 } 336 }
313 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) { 337 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) {
314 return AddChannel(config); 338 return AddChannel(config);
315 } 339 }
316 WEBRTC_FUNC(DeleteChannel, (int channel)) { 340 WEBRTC_FUNC(DeleteChannel, (int channel)) {
317 WEBRTC_CHECK_CHANNEL(channel); 341 WEBRTC_CHECK_CHANNEL(channel);
318 for (const auto& ch : channels_) { 342 for (const auto& ch : channels_) {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 webrtc::EcModes ec_mode_; 792 webrtc::EcModes ec_mode_;
769 webrtc::AecmModes aecm_mode_; 793 webrtc::AecmModes aecm_mode_;
770 webrtc::NsModes ns_mode_; 794 webrtc::NsModes ns_mode_;
771 webrtc::AgcModes agc_mode_; 795 webrtc::AgcModes agc_mode_;
772 webrtc::AgcConfig agc_config_; 796 webrtc::AgcConfig agc_config_;
773 webrtc::VoiceEngineObserver* observer_; 797 webrtc::VoiceEngineObserver* observer_;
774 int playout_fail_channel_; 798 int playout_fail_channel_;
775 int recording_sample_rate_; 799 int recording_sample_rate_;
776 int playout_sample_rate_; 800 int playout_sample_rate_;
777 FakeAudioProcessing audio_processing_; 801 FakeAudioProcessing audio_processing_;
802 FakeAudioDeviceModule audio_device_module_;
778 }; 803 };
779 804
780 } // namespace cricket 805 } // namespace cricket
781 806
782 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_ 807 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/mediaengine.h ('k') | webrtc/media/engine/nullwebrtcvideoengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698