blob: 328ef2b6cc9bd66bcde7b091c62d6185d8b19395 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
3 * Copyright 2010 Google Inc.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
29#define TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
30
31#include <list>
32#include <map>
33#include <vector>
34
henrike@webrtc.org28e20752013-07-10 00:45:36 +000035#include "talk/media/base/codec.h"
buildbot@webrtc.org7e71b772014-06-13 01:14:01 +000036#include "talk/media/base/rtputils.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000037#include "talk/media/base/voiceprocessor.h"
38#include "talk/media/webrtc/fakewebrtccommon.h"
39#include "talk/media/webrtc/webrtcvoe.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000040#include "webrtc/base/basictypes.h"
41#include "webrtc/base/gunit.h"
42#include "webrtc/base/stringutils.h"
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +000043#include "webrtc/modules/audio_processing/include/audio_processing.h"
buildbot@webrtc.orgb4c7b092014-08-25 12:11:58 +000044#include "webrtc/video_engine/include/vie_network.h"
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +000045
henrike@webrtc.org28e20752013-07-10 00:45:36 +000046namespace cricket {
47
48// Function returning stats will return these values
49// for all values based on type.
50const int kIntStatValue = 123;
51const float kFractionLostStatValue = 0.5;
52
53static const char kFakeDefaultDeviceName[] = "Fake Default";
54static const int kFakeDefaultDeviceId = -1;
55static const char kFakeDeviceName[] = "Fake Device";
56#ifdef WIN32
57static const int kFakeDeviceId = 0;
58#else
59static const int kFakeDeviceId = 1;
60#endif
61
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +000062static const int kOpusBandwidthNb = 4000;
63static const int kOpusBandwidthMb = 6000;
64static const int kOpusBandwidthWb = 8000;
65static const int kOpusBandwidthSwb = 12000;
66static const int kOpusBandwidthFb = 20000;
67
minyue@webrtc.orgc0bd7be2015-02-18 15:24:13 +000068static const webrtc::NetworkStatistics kNetStats = {
69 1, // uint16_t currentBufferSize;
70 2, // uint16_t preferredBufferSize;
71 true, // bool jitterPeaksFound;
72 1234, // uint16_t currentPacketLossRate;
73 567, // uint16_t currentDiscardRate;
74 8901, // uint16_t currentExpandRate;
75 234, // uint16_t currentSpeechExpandRate;
76 5678, // uint16_t currentPreemptiveRate;
77 9012, // uint16_t currentAccelerateRate;
78 3456, // uint16_t currentSecondaryDecodedRate;
79 7890, // int32_t clockDriftPPM;
80 54, // meanWaitingTimeMs;
81 32, // int medianWaitingTimeMs;
82 1, // int minWaitingTimeMs;
83 98, // int maxWaitingTimeMs;
84 7654, // int addedSamples;
85}; // These random but non-trivial numbers are used for testing.
86
henrike@webrtc.org79047f92014-03-06 23:46:59 +000087// Verify the header extension ID, if enabled, is within the bounds specified in
88// [RFC5285]: 1-14 inclusive.
89#define WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id) \
90 do { \
91 if (enable && (id < 1 || id > 14)) { \
92 return -1; \
93 } \
94 } while (0);
95
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +000096class FakeAudioProcessing : public webrtc::AudioProcessing {
97 public:
98 FakeAudioProcessing() : experimental_ns_enabled_(false) {}
99
100 WEBRTC_STUB(Initialize, ())
101 WEBRTC_STUB(Initialize, (
102 int input_sample_rate_hz,
103 int output_sample_rate_hz,
104 int reverse_sample_rate_hz,
105 webrtc::AudioProcessing::ChannelLayout input_layout,
106 webrtc::AudioProcessing::ChannelLayout output_layout,
107 webrtc::AudioProcessing::ChannelLayout reverse_layout));
108
109 WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) {
110 experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
111 }
112
113 WEBRTC_STUB(set_sample_rate_hz, (int rate));
114 WEBRTC_STUB_CONST(input_sample_rate_hz, ());
115 WEBRTC_STUB_CONST(sample_rate_hz, ());
116 WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
117 WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
118 WEBRTC_STUB_CONST(num_input_channels, ());
119 WEBRTC_STUB_CONST(num_output_channels, ());
120 WEBRTC_STUB_CONST(num_reverse_channels, ());
121 WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted));
122 WEBRTC_BOOL_STUB_CONST(output_will_be_muted, ());
123 WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame));
124 WEBRTC_STUB(ProcessStream, (
125 const float* const* src,
126 int samples_per_channel,
127 int input_sample_rate_hz,
128 webrtc::AudioProcessing::ChannelLayout input_layout,
129 int output_sample_rate_hz,
130 webrtc::AudioProcessing::ChannelLayout output_layout,
131 float* const* dest));
132 WEBRTC_STUB(AnalyzeReverseStream, (webrtc::AudioFrame* frame));
133 WEBRTC_STUB(AnalyzeReverseStream, (
134 const float* const* data,
135 int samples_per_channel,
136 int sample_rate_hz,
137 webrtc::AudioProcessing::ChannelLayout layout));
138 WEBRTC_STUB(set_stream_delay_ms, (int delay));
139 WEBRTC_STUB_CONST(stream_delay_ms, ());
140 WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ());
141 WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed));
142 WEBRTC_BOOL_STUB_CONST(stream_key_pressed, ());
143 WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset));
144 WEBRTC_STUB_CONST(delay_offset_ms, ());
145 WEBRTC_STUB(StartDebugRecording, (const char filename[kMaxFilenameSize]));
146 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
147 WEBRTC_STUB(StopDebugRecording, ());
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000148 webrtc::EchoCancellation* echo_cancellation() const override { return NULL; }
149 webrtc::EchoControlMobile* echo_control_mobile() const override {
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +0000150 return NULL;
151 }
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000152 webrtc::GainControl* gain_control() const override { return NULL; }
153 webrtc::HighPassFilter* high_pass_filter() const override { return NULL; }
154 webrtc::LevelEstimator* level_estimator() const override { return NULL; }
155 webrtc::NoiseSuppression* noise_suppression() const override { return NULL; }
156 webrtc::VoiceDetection* voice_detection() const override { return NULL; }
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +0000157
158 bool experimental_ns_enabled() {
159 return experimental_ns_enabled_;
160 }
161
162 private:
163 bool experimental_ns_enabled_;
164};
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +0000165
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000166class FakeWebRtcVoiceEngine
167 : public webrtc::VoEAudioProcessing,
168 public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
169 public webrtc::VoEFile, public webrtc::VoEHardware,
170 public webrtc::VoEExternalMedia, public webrtc::VoENetEqStats,
171 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
172 public webrtc::VoEVideoSync, public webrtc::VoEVolumeControl {
173 public:
174 struct DtmfInfo {
175 DtmfInfo()
176 : dtmf_event_code(-1),
177 dtmf_out_of_band(false),
178 dtmf_length_ms(-1) {}
179 int dtmf_event_code;
180 bool dtmf_out_of_band;
181 int dtmf_length_ms;
182 };
183 struct Channel {
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000184 explicit Channel()
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000185 : external_transport(false),
186 send(false),
187 playout(false),
188 volume_scale(1.0),
189 volume_pan_left(1.0),
190 volume_pan_right(1.0),
191 file(false),
192 vad(false),
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000193 codec_fec(false),
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000194 max_encoding_bandwidth(0),
minyue@webrtc.org9b2e1142015-03-13 09:38:07 +0000195 opus_dtx(false),
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000196 red(false),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000197 nack(false),
198 media_processor_registered(false),
wu@webrtc.org97077a32013-10-25 21:18:33 +0000199 rx_agc_enabled(false),
200 rx_agc_mode(webrtc::kAgcDefault),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000201 cn8_type(13),
202 cn16_type(105),
203 dtmf_type(106),
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000204 red_type(117),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000205 nack_max_packets(0),
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000206 vie_network(NULL),
207 video_channel(-1),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000208 send_ssrc(0),
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000209 send_audio_level_ext_(-1),
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000210 receive_audio_level_ext_(-1),
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000211 send_absolute_sender_time_ext_(-1),
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000212 receive_absolute_sender_time_ext_(-1) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000213 memset(&send_codec, 0, sizeof(send_codec));
wu@webrtc.org97077a32013-10-25 21:18:33 +0000214 memset(&rx_agc_config, 0, sizeof(rx_agc_config));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000215 }
216 bool external_transport;
217 bool send;
218 bool playout;
219 float volume_scale;
220 float volume_pan_left;
221 float volume_pan_right;
222 bool file;
223 bool vad;
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000224 bool codec_fec;
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000225 int max_encoding_bandwidth;
minyue@webrtc.org9b2e1142015-03-13 09:38:07 +0000226 bool opus_dtx;
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000227 bool red;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000228 bool nack;
229 bool media_processor_registered;
wu@webrtc.org97077a32013-10-25 21:18:33 +0000230 bool rx_agc_enabled;
231 webrtc::AgcModes rx_agc_mode;
232 webrtc::AgcConfig rx_agc_config;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000233 int cn8_type;
234 int cn16_type;
235 int dtmf_type;
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000236 int red_type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000237 int nack_max_packets;
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000238 webrtc::ViENetwork* vie_network;
239 int video_channel;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000240 uint32 send_ssrc;
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000241 int send_audio_level_ext_;
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000242 int receive_audio_level_ext_;
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000243 int send_absolute_sender_time_ext_;
244 int receive_absolute_sender_time_ext_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000245 DtmfInfo dtmf_info;
246 std::vector<webrtc::CodecInst> recv_codecs;
247 webrtc::CodecInst send_codec;
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000248 webrtc::PacketTime last_rtp_packet_time;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000249 std::list<std::string> packets;
250 };
251
252 FakeWebRtcVoiceEngine(const cricket::AudioCodec* const* codecs,
253 int num_codecs)
254 : inited_(false),
255 last_channel_(-1),
256 fail_create_channel_(false),
257 codecs_(codecs),
258 num_codecs_(num_codecs),
wu@webrtc.org05e7b442014-04-01 17:44:24 +0000259 num_set_send_codecs_(0),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000260 ec_enabled_(false),
261 ec_metrics_enabled_(false),
262 cng_enabled_(false),
263 ns_enabled_(false),
264 agc_enabled_(false),
265 highpass_filter_enabled_(false),
266 stereo_swapping_enabled_(false),
267 typing_detection_enabled_(false),
268 ec_mode_(webrtc::kEcDefault),
269 aecm_mode_(webrtc::kAecmSpeakerphone),
270 ns_mode_(webrtc::kNsDefault),
271 agc_mode_(webrtc::kAgcDefault),
272 observer_(NULL),
273 playout_fail_channel_(-1),
274 send_fail_channel_(-1),
275 fail_start_recording_microphone_(false),
276 recording_microphone_(false),
wu@webrtc.org97077a32013-10-25 21:18:33 +0000277 recording_sample_rate_(-1),
278 playout_sample_rate_(-1),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000279 media_processor_(NULL) {
280 memset(&agc_config_, 0, sizeof(agc_config_));
281 }
282 ~FakeWebRtcVoiceEngine() {
283 // Ought to have all been deleted by the WebRtcVoiceMediaChannel
284 // destructors, but just in case ...
285 for (std::map<int, Channel*>::const_iterator i = channels_.begin();
286 i != channels_.end(); ++i) {
287 delete i->second;
288 }
289 }
290
291 bool IsExternalMediaProcessorRegistered() const {
292 return media_processor_ != NULL;
293 }
294 bool IsInited() const { return inited_; }
295 int GetLastChannel() const { return last_channel_; }
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000296 int GetChannelFromLocalSsrc(uint32 local_ssrc) const {
297 for (std::map<int, Channel*>::const_iterator iter = channels_.begin();
298 iter != channels_.end(); ++iter) {
299 if (local_ssrc == iter->second->send_ssrc)
300 return iter->first;
301 }
302 return -1;
303 }
wu@webrtc.org9caf2762013-12-11 18:25:07 +0000304 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000305 bool GetPlayout(int channel) {
306 return channels_[channel]->playout;
307 }
308 bool GetSend(int channel) {
309 return channels_[channel]->send;
310 }
311 bool GetRecordingMicrophone() {
312 return recording_microphone_;
313 }
314 bool GetVAD(int channel) {
315 return channels_[channel]->vad;
316 }
Minyue Li7100dcd2015-03-27 05:05:59 +0100317 bool GetOpusDtx(int channel) {
318 return channels_[channel]->opus_dtx;
319 }
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000320 bool GetRED(int channel) {
321 return channels_[channel]->red;
322 }
323 bool GetCodecFEC(int channel) {
324 return channels_[channel]->codec_fec;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000325 }
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000326 int GetMaxEncodingBandwidth(int channel) {
327 return channels_[channel]->max_encoding_bandwidth;
328 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000329 bool GetNACK(int channel) {
330 return channels_[channel]->nack;
331 }
332 int GetNACKMaxPackets(int channel) {
333 return channels_[channel]->nack_max_packets;
334 }
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000335 webrtc::ViENetwork* GetViENetwork(int channel) {
336 WEBRTC_ASSERT_CHANNEL(channel);
buildbot@webrtc.orgb4c7b092014-08-25 12:11:58 +0000337 // WARNING: This pointer is for verification purposes only. Calling
338 // functions on it may result in undefined behavior!
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000339 return channels_[channel]->vie_network;
340 }
341 int GetVideoChannel(int channel) {
342 WEBRTC_ASSERT_CHANNEL(channel);
343 return channels_[channel]->video_channel;
344 }
345 const webrtc::PacketTime& GetLastRtpPacketTime(int channel) {
346 WEBRTC_ASSERT_CHANNEL(channel);
347 return channels_[channel]->last_rtp_packet_time;
348 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000349 int GetSendCNPayloadType(int channel, bool wideband) {
350 return (wideband) ?
351 channels_[channel]->cn16_type :
352 channels_[channel]->cn8_type;
353 }
354 int GetSendTelephoneEventPayloadType(int channel) {
355 return channels_[channel]->dtmf_type;
356 }
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000357 int GetSendREDPayloadType(int channel) {
358 return channels_[channel]->red_type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000359 }
360 bool CheckPacket(int channel, const void* data, size_t len) {
361 bool result = !CheckNoPacket(channel);
362 if (result) {
363 std::string packet = channels_[channel]->packets.front();
364 result = (packet == std::string(static_cast<const char*>(data), len));
365 channels_[channel]->packets.pop_front();
366 }
367 return result;
368 }
369 bool CheckNoPacket(int channel) {
370 return channels_[channel]->packets.empty();
371 }
372 void TriggerCallbackOnError(int channel_num, int err_code) {
373 ASSERT(observer_ != NULL);
374 observer_->CallbackOnError(channel_num, err_code);
375 }
376 void set_playout_fail_channel(int channel) {
377 playout_fail_channel_ = channel;
378 }
379 void set_send_fail_channel(int channel) {
380 send_fail_channel_ = channel;
381 }
382 void set_fail_start_recording_microphone(
383 bool fail_start_recording_microphone) {
384 fail_start_recording_microphone_ = fail_start_recording_microphone;
385 }
386 void set_fail_create_channel(bool fail_create_channel) {
387 fail_create_channel_ = fail_create_channel;
388 }
389 void TriggerProcessPacket(MediaProcessorDirection direction) {
390 webrtc::ProcessingTypes pt =
391 (direction == cricket::MPD_TX) ?
392 webrtc::kRecordingPerChannel : webrtc::kPlaybackAllChannelsMixed;
393 if (media_processor_ != NULL) {
394 media_processor_->Process(0,
395 pt,
396 NULL,
397 0,
398 0,
399 true);
400 }
401 }
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000402 int AddChannel() {
wu@webrtc.org364f2042013-11-20 21:49:41 +0000403 if (fail_create_channel_) {
404 return -1;
405 }
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000406 Channel* ch = new Channel();
wu@webrtc.org364f2042013-11-20 21:49:41 +0000407 for (int i = 0; i < NumOfCodecs(); ++i) {
408 webrtc::CodecInst codec;
409 GetCodec(i, codec);
410 ch->recv_codecs.push_back(codec);
411 }
412 channels_[++last_channel_] = ch;
413 return last_channel_;
414 }
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000415 int GetSendRtpExtensionId(int channel, const std::string& extension) {
416 WEBRTC_ASSERT_CHANNEL(channel);
417 if (extension == kRtpAudioLevelHeaderExtension) {
418 return channels_[channel]->send_audio_level_ext_;
419 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) {
420 return channels_[channel]->send_absolute_sender_time_ext_;
421 }
422 return -1;
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000423 }
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000424 int GetReceiveRtpExtensionId(int channel, const std::string& extension) {
425 WEBRTC_ASSERT_CHANNEL(channel);
426 if (extension == kRtpAudioLevelHeaderExtension) {
427 return channels_[channel]->receive_audio_level_ext_;
428 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) {
429 return channels_[channel]->receive_absolute_sender_time_ext_;
430 }
431 return -1;
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000432 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000433
wu@webrtc.org05e7b442014-04-01 17:44:24 +0000434 int GetNumSetSendCodecs() const { return num_set_send_codecs_; }
435
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000436 WEBRTC_STUB(Release, ());
437
438 // webrtc::VoEBase
439 WEBRTC_FUNC(RegisterVoiceEngineObserver, (
440 webrtc::VoiceEngineObserver& observer)) {
441 observer_ = &observer;
442 return 0;
443 }
444 WEBRTC_STUB(DeRegisterVoiceEngineObserver, ());
445 WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm,
446 webrtc::AudioProcessing* audioproc)) {
447 inited_ = true;
448 return 0;
449 }
450 WEBRTC_FUNC(Terminate, ()) {
451 inited_ = false;
452 return 0;
453 }
kjellander@webrtc.org14665ff2015-03-04 12:58:35 +0000454 webrtc::AudioProcessing* audio_processing() override {
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +0000455 return &audio_processing_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000456 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000457 WEBRTC_FUNC(CreateChannel, ()) {
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000458 return AddChannel();
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000459 }
buildbot@webrtc.orgaf6640f2014-04-28 21:31:51 +0000460 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& /*config*/)) {
461 return AddChannel();
wu@webrtc.org364f2042013-11-20 21:49:41 +0000462 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000463 WEBRTC_FUNC(DeleteChannel, (int channel)) {
464 WEBRTC_CHECK_CHANNEL(channel);
465 delete channels_[channel];
466 channels_.erase(channel);
467 return 0;
468 }
469 WEBRTC_STUB(StartReceive, (int channel));
470 WEBRTC_FUNC(StartPlayout, (int channel)) {
471 if (playout_fail_channel_ != channel) {
472 WEBRTC_CHECK_CHANNEL(channel);
473 channels_[channel]->playout = true;
474 return 0;
475 } else {
476 // When playout_fail_channel_ == channel, fail the StartPlayout on this
477 // channel.
478 return -1;
479 }
480 }
481 WEBRTC_FUNC(StartSend, (int channel)) {
482 if (send_fail_channel_ != channel) {
483 WEBRTC_CHECK_CHANNEL(channel);
484 channels_[channel]->send = true;
485 return 0;
486 } else {
487 // When send_fail_channel_ == channel, fail the StartSend on this
488 // channel.
489 return -1;
490 }
491 }
492 WEBRTC_STUB(StopReceive, (int channel));
493 WEBRTC_FUNC(StopPlayout, (int channel)) {
494 WEBRTC_CHECK_CHANNEL(channel);
495 channels_[channel]->playout = false;
496 return 0;
497 }
498 WEBRTC_FUNC(StopSend, (int channel)) {
499 WEBRTC_CHECK_CHANNEL(channel);
500 channels_[channel]->send = false;
501 return 0;
502 }
503 WEBRTC_STUB(GetVersion, (char version[1024]));
504 WEBRTC_STUB(LastError, ());
505 WEBRTC_STUB(SetOnHoldStatus, (int, bool, webrtc::OnHoldModes));
506 WEBRTC_STUB(GetOnHoldStatus, (int, bool&, webrtc::OnHoldModes&));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000507
508 // webrtc::VoECodec
509 WEBRTC_FUNC(NumOfCodecs, ()) {
510 return num_codecs_;
511 }
512 WEBRTC_FUNC(GetCodec, (int index, webrtc::CodecInst& codec)) {
513 if (index < 0 || index >= NumOfCodecs()) {
514 return -1;
515 }
516 const cricket::AudioCodec& c(*codecs_[index]);
517 codec.pltype = c.id;
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000518 rtc::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000519 codec.plfreq = c.clockrate;
520 codec.pacsize = 0;
521 codec.channels = c.channels;
522 codec.rate = c.bitrate;
523 return 0;
524 }
525 WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) {
526 WEBRTC_CHECK_CHANNEL(channel);
henrike@webrtc.org704bf9e2014-02-27 17:52:04 +0000527 // To match the behavior of the real implementation.
528 if (_stricmp(codec.plname, "telephone-event") == 0 ||
529 _stricmp(codec.plname, "audio/telephone-event") == 0 ||
530 _stricmp(codec.plname, "CN") == 0 ||
531 _stricmp(codec.plname, "red") == 0 ) {
532 return -1;
533 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000534 channels_[channel]->send_codec = codec;
wu@webrtc.org05e7b442014-04-01 17:44:24 +0000535 ++num_set_send_codecs_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000536 return 0;
537 }
538 WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
539 WEBRTC_CHECK_CHANNEL(channel);
540 codec = channels_[channel]->send_codec;
541 return 0;
542 }
Ivo Creusenadf89b72015-04-29 16:03:33 +0200543 WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps));
buildbot@webrtc.org7e71b772014-06-13 01:14:01 +0000544 WEBRTC_FUNC(GetRecCodec, (int channel, webrtc::CodecInst& codec)) {
545 WEBRTC_CHECK_CHANNEL(channel);
546 const Channel* c = channels_[channel];
547 for (std::list<std::string>::const_iterator it_packet = c->packets.begin();
548 it_packet != c->packets.end(); ++it_packet) {
549 int pltype;
550 if (!GetRtpPayloadType(it_packet->data(), it_packet->length(), &pltype)) {
551 continue;
552 }
553 for (std::vector<webrtc::CodecInst>::const_iterator it_codec =
554 c->recv_codecs.begin(); it_codec != c->recv_codecs.end();
555 ++it_codec) {
556 if (it_codec->pltype == pltype) {
557 codec = *it_codec;
558 return 0;
559 }
560 }
561 }
562 return -1;
563 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000564 WEBRTC_STUB(SetAMREncFormat, (int channel, webrtc::AmrMode mode));
565 WEBRTC_STUB(SetAMRDecFormat, (int channel, webrtc::AmrMode mode));
566 WEBRTC_STUB(SetAMRWbEncFormat, (int channel, webrtc::AmrMode mode));
567 WEBRTC_STUB(SetAMRWbDecFormat, (int channel, webrtc::AmrMode mode));
568 WEBRTC_STUB(SetISACInitTargetRate, (int channel, int rateBps,
569 bool useFixedFrameSize));
570 WEBRTC_STUB(SetISACMaxRate, (int channel, int rateBps));
571 WEBRTC_STUB(SetISACMaxPayloadSize, (int channel, int sizeBytes));
572 WEBRTC_FUNC(SetRecPayloadType, (int channel,
573 const webrtc::CodecInst& codec)) {
574 WEBRTC_CHECK_CHANNEL(channel);
575 Channel* ch = channels_[channel];
576 if (ch->playout)
577 return -1; // Channel is in use.
578 // Check if something else already has this slot.
579 if (codec.pltype != -1) {
580 for (std::vector<webrtc::CodecInst>::iterator it =
581 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
582 if (it->pltype == codec.pltype &&
583 _stricmp(it->plname, codec.plname) != 0) {
584 return -1;
585 }
586 }
587 }
588 // Otherwise try to find this codec and update its payload type.
589 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
590 it != ch->recv_codecs.end(); ++it) {
591 if (strcmp(it->plname, codec.plname) == 0 &&
592 it->plfreq == codec.plfreq) {
593 it->pltype = codec.pltype;
594 it->channels = codec.channels;
595 return 0;
596 }
597 }
598 return -1; // not found
599 }
600 WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type,
601 webrtc::PayloadFrequencies frequency)) {
602 WEBRTC_CHECK_CHANNEL(channel);
603 if (frequency == webrtc::kFreq8000Hz) {
604 channels_[channel]->cn8_type = type;
605 } else if (frequency == webrtc::kFreq16000Hz) {
606 channels_[channel]->cn16_type = type;
607 }
608 return 0;
609 }
610 WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) {
611 WEBRTC_CHECK_CHANNEL(channel);
612 Channel* ch = channels_[channel];
613 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
614 it != ch->recv_codecs.end(); ++it) {
615 if (strcmp(it->plname, codec.plname) == 0 &&
616 it->plfreq == codec.plfreq &&
617 it->channels == codec.channels &&
618 it->pltype != -1) {
619 codec.pltype = it->pltype;
620 return 0;
621 }
622 }
623 return -1; // not found
624 }
625 WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode,
626 bool disableDTX)) {
627 WEBRTC_CHECK_CHANNEL(channel);
628 if (channels_[channel]->send_codec.channels == 2) {
629 // Replicating VoE behavior; VAD cannot be enabled for stereo.
630 return -1;
631 }
632 channels_[channel]->vad = enable;
633 return 0;
634 }
635 WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
636 webrtc::VadModes& mode, bool& disabledDTX));
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000637
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000638 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
639 WEBRTC_CHECK_CHANNEL(channel);
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000640 if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
buildbot@webrtc.org3ffa1f92014-07-02 19:51:26 +0000641 // Return -1 if current send codec is not Opus.
642 // TODO(minyue): Excludes other codecs if they support inband FEC.
643 return -1;
644 }
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000645 channels_[channel]->codec_fec = enable;
646 return 0;
647 }
648 WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) {
649 WEBRTC_CHECK_CHANNEL(channel);
650 enable = channels_[channel]->codec_fec;
651 return 0;
652 }
buildbot@webrtc.org5d639b32014-09-10 07:57:12 +0000653
654 WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) {
655 WEBRTC_CHECK_CHANNEL(channel);
656 if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
657 // Return -1 if current send codec is not Opus.
658 return -1;
659 }
660 if (frequency_hz <= 8000)
661 channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb;
662 else if (frequency_hz <= 12000)
663 channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb;
664 else if (frequency_hz <= 16000)
665 channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb;
666 else if (frequency_hz <= 24000)
667 channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb;
668 else
669 channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb;
670 return 0;
671 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000672
minyue@webrtc.org9b2e1142015-03-13 09:38:07 +0000673 WEBRTC_FUNC(SetOpusDtx, (int channel, bool enable_dtx)) {
674 WEBRTC_CHECK_CHANNEL(channel);
675 if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
676 // Return -1 if current send codec is not Opus.
677 return -1;
678 }
679 channels_[channel]->opus_dtx = enable_dtx;
680 return 0;
681 }
682
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000683 // webrtc::VoEDtmf
684 WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
685 bool out_of_band = true, int length_ms = 160, int attenuation_db = 10)) {
686 channels_[channel]->dtmf_info.dtmf_event_code = event_code;
687 channels_[channel]->dtmf_info.dtmf_out_of_band = out_of_band;
688 channels_[channel]->dtmf_info.dtmf_length_ms = length_ms;
689 return 0;
690 }
691
692 WEBRTC_FUNC(SetSendTelephoneEventPayloadType,
693 (int channel, unsigned char type)) {
694 channels_[channel]->dtmf_type = type;
695 return 0;
696 };
697 WEBRTC_STUB(GetSendTelephoneEventPayloadType,
698 (int channel, unsigned char& type));
699
700 WEBRTC_STUB(SetDtmfFeedbackStatus, (bool enable, bool directFeedback));
701 WEBRTC_STUB(GetDtmfFeedbackStatus, (bool& enabled, bool& directFeedback));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000702
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000703 WEBRTC_FUNC(PlayDtmfTone,
704 (int event_code, int length_ms = 200, int attenuation_db = 10)) {
705 dtmf_info_.dtmf_event_code = event_code;
706 dtmf_info_.dtmf_length_ms = length_ms;
707 return 0;
708 }
709 WEBRTC_STUB(StartPlayingDtmfTone,
710 (int eventCode, int attenuationDb = 10));
711 WEBRTC_STUB(StopPlayingDtmfTone, ());
712
713 // webrtc::VoEFile
714 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, const char* fileNameUTF8,
715 bool loop, webrtc::FileFormats format,
716 float volumeScaling, int startPointMs,
717 int stopPointMs)) {
718 WEBRTC_CHECK_CHANNEL(channel);
719 channels_[channel]->file = true;
720 return 0;
721 }
722 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, webrtc::InStream* stream,
723 webrtc::FileFormats format,
724 float volumeScaling, int startPointMs,
725 int stopPointMs)) {
726 WEBRTC_CHECK_CHANNEL(channel);
727 channels_[channel]->file = true;
728 return 0;
729 }
730 WEBRTC_FUNC(StopPlayingFileLocally, (int channel)) {
731 WEBRTC_CHECK_CHANNEL(channel);
732 channels_[channel]->file = false;
733 return 0;
734 }
735 WEBRTC_FUNC(IsPlayingFileLocally, (int channel)) {
736 WEBRTC_CHECK_CHANNEL(channel);
737 return (channels_[channel]->file) ? 1 : 0;
738 }
739 WEBRTC_STUB(ScaleLocalFilePlayout, (int channel, float scale));
740 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
741 const char* fileNameUTF8,
742 bool loop,
743 bool mixWithMicrophone,
744 webrtc::FileFormats format,
745 float volumeScaling));
746 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
747 webrtc::InStream* stream,
748 bool mixWithMicrophone,
749 webrtc::FileFormats format,
750 float volumeScaling));
751 WEBRTC_STUB(StopPlayingFileAsMicrophone, (int channel));
752 WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel));
753 WEBRTC_STUB(ScaleFileAsMicrophonePlayout, (int channel, float scale));
754 WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8,
755 webrtc::CodecInst* compression,
756 int maxSizeBytes));
757 WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream,
758 webrtc::CodecInst* compression));
759 WEBRTC_STUB(StopRecordingPlayout, (int channel));
760 WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8,
761 webrtc::CodecInst* compression,
762 int maxSizeBytes)) {
763 if (fail_start_recording_microphone_) {
764 return -1;
765 }
766 recording_microphone_ = true;
767 return 0;
768 }
769 WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream,
770 webrtc::CodecInst* compression)) {
771 if (fail_start_recording_microphone_) {
772 return -1;
773 }
774 recording_microphone_ = true;
775 return 0;
776 }
777 WEBRTC_FUNC(StopRecordingMicrophone, ()) {
778 if (!recording_microphone_) {
779 return -1;
780 }
781 recording_microphone_ = false;
782 return 0;
783 }
784 WEBRTC_STUB(ConvertPCMToWAV, (const char* fileNameInUTF8,
785 const char* fileNameOutUTF8));
786 WEBRTC_STUB(ConvertPCMToWAV, (webrtc::InStream* streamIn,
787 webrtc::OutStream* streamOut));
788 WEBRTC_STUB(ConvertWAVToPCM, (const char* fileNameInUTF8,
789 const char* fileNameOutUTF8));
790 WEBRTC_STUB(ConvertWAVToPCM, (webrtc::InStream* streamIn,
791 webrtc::OutStream* streamOut));
792 WEBRTC_STUB(ConvertPCMToCompressed, (const char* fileNameInUTF8,
793 const char* fileNameOutUTF8,
794 webrtc::CodecInst* compression));
795 WEBRTC_STUB(ConvertPCMToCompressed, (webrtc::InStream* streamIn,
796 webrtc::OutStream* streamOut,
797 webrtc::CodecInst* compression));
798 WEBRTC_STUB(ConvertCompressedToPCM, (const char* fileNameInUTF8,
799 const char* fileNameOutUTF8));
800 WEBRTC_STUB(ConvertCompressedToPCM, (webrtc::InStream* streamIn,
801 webrtc::OutStream* streamOut));
802 WEBRTC_STUB(GetFileDuration, (const char* fileNameUTF8, int& durationMs,
803 webrtc::FileFormats format));
804 WEBRTC_STUB(GetPlaybackPosition, (int channel, int& positionMs));
805
806 // webrtc::VoEHardware
807 WEBRTC_STUB(GetCPULoad, (int&));
808 WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) {
809 return GetNumDevices(num);
810 }
811 WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) {
812 return GetNumDevices(num);
813 }
814 WEBRTC_FUNC(GetRecordingDeviceName, (int i, char* name, char* guid)) {
815 return GetDeviceName(i, name, guid);
816 }
817 WEBRTC_FUNC(GetPlayoutDeviceName, (int i, char* name, char* guid)) {
818 return GetDeviceName(i, name, guid);
819 }
820 WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel));
821 WEBRTC_STUB(SetPlayoutDevice, (int));
822 WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers));
823 WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&));
824 WEBRTC_STUB(GetPlayoutDeviceStatus, (bool&));
825 WEBRTC_STUB(GetRecordingDeviceStatus, (bool&));
826 WEBRTC_STUB(ResetAudioDevice, ());
827 WEBRTC_STUB(AudioDeviceControl, (unsigned int, unsigned int, unsigned int));
828 WEBRTC_STUB(SetLoudspeakerStatus, (bool enable));
829 WEBRTC_STUB(GetLoudspeakerStatus, (bool& enabled));
wu@webrtc.org97077a32013-10-25 21:18:33 +0000830 WEBRTC_FUNC(SetRecordingSampleRate, (unsigned int samples_per_sec)) {
831 recording_sample_rate_ = samples_per_sec;
832 return 0;
833 }
834 WEBRTC_FUNC_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)) {
835 *samples_per_sec = recording_sample_rate_;
836 return 0;
837 }
838 WEBRTC_FUNC(SetPlayoutSampleRate, (unsigned int samples_per_sec)) {
839 playout_sample_rate_ = samples_per_sec;
840 return 0;
841 }
842 WEBRTC_FUNC_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)) {
843 *samples_per_sec = playout_sample_rate_;
844 return 0;
845 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000846 WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
847 virtual bool BuiltInAECIsEnabled() const { return true; }
henrika@webrtc.orga954c072014-12-09 16:22:09 +0000848 virtual bool BuiltInAECIsAvailable() const { return false; }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000849
850 // webrtc::VoENetEqStats
minyue@webrtc.orgc0bd7be2015-02-18 15:24:13 +0000851 WEBRTC_FUNC(GetNetworkStatistics, (int channel,
852 webrtc::NetworkStatistics& ns)) {
853 WEBRTC_CHECK_CHANNEL(channel);
854 memcpy(&ns, &kNetStats, sizeof(webrtc::NetworkStatistics));
855 return 0;
856 }
857
wu@webrtc.org24301a62013-12-13 19:17:43 +0000858 WEBRTC_FUNC_CONST(GetDecodingCallStatistics, (int channel,
859 webrtc::AudioDecodingCallStats*)) {
860 WEBRTC_CHECK_CHANNEL(channel);
861 return 0;
862 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000863
864 // webrtc::VoENetwork
865 WEBRTC_FUNC(RegisterExternalTransport, (int channel,
866 webrtc::Transport& transport)) {
867 WEBRTC_CHECK_CHANNEL(channel);
868 channels_[channel]->external_transport = true;
869 return 0;
870 }
871 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) {
872 WEBRTC_CHECK_CHANNEL(channel);
873 channels_[channel]->external_transport = false;
874 return 0;
875 }
876 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +0000877 size_t length)) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000878 WEBRTC_CHECK_CHANNEL(channel);
879 if (!channels_[channel]->external_transport) return -1;
880 channels_[channel]->packets.push_back(
881 std::string(static_cast<const char*>(data), length));
882 return 0;
883 }
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000884 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +0000885 size_t length,
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000886 const webrtc::PacketTime& packet_time)) {
887 WEBRTC_CHECK_CHANNEL(channel);
888 if (ReceivedRTPPacket(channel, data, length) == -1) {
889 return -1;
890 }
891 channels_[channel]->last_rtp_packet_time = packet_time;
892 return 0;
893 }
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +0000894
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000895 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data,
pkasting@chromium.org4591fbd2014-11-20 22:28:14 +0000896 size_t length));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000897
898 // webrtc::VoERTP_RTCP
899 WEBRTC_STUB(RegisterRTPObserver, (int channel,
900 webrtc::VoERTPObserver& observer));
901 WEBRTC_STUB(DeRegisterRTPObserver, (int channel));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000902 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
903 WEBRTC_CHECK_CHANNEL(channel);
904 channels_[channel]->send_ssrc = ssrc;
905 return 0;
906 }
907 WEBRTC_FUNC(GetLocalSSRC, (int channel, unsigned int& ssrc)) {
908 WEBRTC_CHECK_CHANNEL(channel);
909 ssrc = channels_[channel]->send_ssrc;
910 return 0;
911 }
912 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000913 WEBRTC_FUNC(SetSendAudioLevelIndicationStatus, (int channel, bool enable,
914 unsigned char id)) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000915 WEBRTC_CHECK_CHANNEL(channel);
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000916 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
917 channels_[channel]->send_audio_level_ext_ = (enable) ? id : -1;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000918 return 0;
919 }
buildbot@webrtc.org150835e2014-05-06 15:54:38 +0000920 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable,
921 unsigned char id)) {
922 WEBRTC_CHECK_CHANNEL(channel);
923 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
924 channels_[channel]->receive_audio_level_ext_ = (enable) ? id : -1;
925 return 0;
926 }
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000927 WEBRTC_FUNC(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable,
928 unsigned char id)) {
929 WEBRTC_CHECK_CHANNEL(channel);
930 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
931 channels_[channel]->send_absolute_sender_time_ext_ = (enable) ? id : -1;
932 return 0;
933 }
934 WEBRTC_FUNC(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable,
935 unsigned char id)) {
936 WEBRTC_CHECK_CHANNEL(channel);
937 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
938 channels_[channel]->receive_absolute_sender_time_ext_ = (enable) ? id : -1;
939 return 0;
940 }
henrike@webrtc.org79047f92014-03-06 23:46:59 +0000941
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000942 WEBRTC_STUB(GetRemoteCSRCs, (int channel, unsigned int arrCSRC[15]));
943 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable));
944 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
945 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
946 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
947 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
948 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
949 unsigned int& NTPLow,
950 unsigned int& timestamp,
951 unsigned int& playoutTimestamp,
952 unsigned int* jitter,
953 unsigned short* fractionLost));
954 WEBRTC_STUB(GetRemoteRTCPSenderInfo, (int channel,
955 webrtc::SenderInfo* sender_info));
956 WEBRTC_FUNC(GetRemoteRTCPReportBlocks,
957 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks)) {
958 WEBRTC_CHECK_CHANNEL(channel);
959 webrtc::ReportBlock block;
960 block.source_SSRC = channels_[channel]->send_ssrc;
961 webrtc::CodecInst send_codec = channels_[channel]->send_codec;
962 if (send_codec.pltype >= 0) {
963 block.fraction_lost = (unsigned char)(kFractionLostStatValue * 256);
964 if (send_codec.plfreq / 1000 > 0) {
965 block.interarrival_jitter = kIntStatValue * (send_codec.plfreq / 1000);
966 }
967 block.cumulative_num_packets_lost = kIntStatValue;
968 block.extended_highest_sequence_number = kIntStatValue;
969 receive_blocks->push_back(block);
970 }
971 return 0;
972 }
973 WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (int channel,
974 unsigned char subType,
975 unsigned int name,
976 const char* data,
977 unsigned short dataLength));
978 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
979 unsigned int& maxJitterMs,
980 unsigned int& discardedPackets));
981 WEBRTC_FUNC(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)) {
982 WEBRTC_CHECK_CHANNEL(channel);
983 stats.fractionLost = static_cast<int16>(kIntStatValue);
984 stats.cumulativeLost = kIntStatValue;
985 stats.extendedMax = kIntStatValue;
986 stats.jitterSamples = kIntStatValue;
987 stats.rttMs = kIntStatValue;
988 stats.bytesSent = kIntStatValue;
989 stats.packetsSent = kIntStatValue;
990 stats.bytesReceived = kIntStatValue;
991 stats.packetsReceived = kIntStatValue;
992 return 0;
993 }
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +0000994 WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
buildbot@webrtc.orgbfa758a2014-06-27 16:04:43 +0000995 return SetFECStatus(channel, enable, redPayloadtype);
996 }
buildbot@webrtc.orgbfa758a2014-06-27 16:04:43 +0000997 // TODO(minyue): remove the below function when transition to SetREDStatus
998 // is finished.
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000999 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
1000 WEBRTC_CHECK_CHANNEL(channel);
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +00001001 channels_[channel]->red = enable;
1002 channels_[channel]->red_type = redPayloadtype;
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001003 return 0;
1004 }
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +00001005 WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) {
buildbot@webrtc.orgbfa758a2014-06-27 16:04:43 +00001006 return GetFECStatus(channel, enable, redPayloadtype);
1007 }
buildbot@webrtc.orgbfa758a2014-06-27 16:04:43 +00001008 // TODO(minyue): remove the below function when transition to GetREDStatus
1009 // is finished.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001010 WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
1011 WEBRTC_CHECK_CHANNEL(channel);
buildbot@webrtc.orgae740dd2014-06-17 10:56:41 +00001012 enable = channels_[channel]->red;
1013 redPayloadtype = channels_[channel]->red_type;
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001014 return 0;
1015 }
1016 WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
1017 WEBRTC_CHECK_CHANNEL(channel);
1018 channels_[channel]->nack = enable;
1019 channels_[channel]->nack_max_packets = maxNoPackets;
1020 return 0;
1021 }
1022 WEBRTC_STUB(StartRTPDump, (int channel, const char* fileNameUTF8,
1023 webrtc::RTPDirections direction));
1024 WEBRTC_STUB(StopRTPDump, (int channel, webrtc::RTPDirections direction));
1025 WEBRTC_STUB(RTPDumpIsActive, (int channel, webrtc::RTPDirections direction));
1026 WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType,
1027 bool markerBit, const char* payloadData,
1028 unsigned short payloadSize));
1029 WEBRTC_STUB(GetLastRemoteTimeStamp, (int channel,
1030 uint32_t* lastRemoteTimeStamp));
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +00001031 WEBRTC_FUNC(SetVideoEngineBWETarget, (int channel,
1032 webrtc::ViENetwork* vie_network,
1033 int video_channel)) {
1034 WEBRTC_CHECK_CHANNEL(channel);
1035 channels_[channel]->vie_network = vie_network;
1036 channels_[channel]->video_channel = video_channel;
buildbot@webrtc.orgb4c7b092014-08-25 12:11:58 +00001037 if (vie_network) {
1038 // The interface is released here to avoid leaks. A test should not
1039 // attempt to call functions on the interface stored in the channel.
1040 vie_network->Release();
1041 }
buildbot@webrtc.orgf875f152014-04-14 16:06:21 +00001042 return 0;
1043 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001044
1045 // webrtc::VoEVideoSync
1046 WEBRTC_STUB(GetPlayoutBufferSize, (int& bufferMs));
1047 WEBRTC_STUB(GetPlayoutTimestamp, (int channel, unsigned int& timestamp));
wu@webrtc.org822fbd82013-08-15 23:38:54 +00001048 WEBRTC_STUB(GetRtpRtcp, (int, webrtc::RtpRtcp**, webrtc::RtpReceiver**));
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001049 WEBRTC_STUB(SetInitTimestamp, (int channel, unsigned int timestamp));
1050 WEBRTC_STUB(SetInitSequenceNumber, (int channel, short sequenceNumber));
1051 WEBRTC_STUB(SetMinimumPlayoutDelay, (int channel, int delayMs));
1052 WEBRTC_STUB(SetInitialPlayoutDelay, (int channel, int delay_ms));
1053 WEBRTC_STUB(GetDelayEstimate, (int channel, int* jitter_buffer_delay_ms,
1054 int* playout_buffer_delay_ms));
1055 WEBRTC_STUB_CONST(GetLeastRequiredDelayMs, (int channel));
1056
1057 // webrtc::VoEVolumeControl
1058 WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
1059 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
1060 WEBRTC_STUB(SetSystemOutputMute, (bool));
1061 WEBRTC_STUB(GetSystemOutputMute, (bool&));
1062 WEBRTC_STUB(SetMicVolume, (unsigned int));
1063 WEBRTC_STUB(GetMicVolume, (unsigned int&));
1064 WEBRTC_STUB(SetInputMute, (int, bool));
1065 WEBRTC_STUB(GetInputMute, (int, bool&));
1066 WEBRTC_STUB(SetSystemInputMute, (bool));
1067 WEBRTC_STUB(GetSystemInputMute, (bool&));
1068 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
1069 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
1070 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
1071 WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&));
1072 WEBRTC_FUNC(SetChannelOutputVolumeScaling, (int channel, float scale)) {
1073 WEBRTC_CHECK_CHANNEL(channel);
1074 channels_[channel]->volume_scale= scale;
1075 return 0;
1076 }
1077 WEBRTC_FUNC(GetChannelOutputVolumeScaling, (int channel, float& scale)) {
1078 WEBRTC_CHECK_CHANNEL(channel);
1079 scale = channels_[channel]->volume_scale;
1080 return 0;
1081 }
1082 WEBRTC_FUNC(SetOutputVolumePan, (int channel, float left, float right)) {
1083 WEBRTC_CHECK_CHANNEL(channel);
1084 channels_[channel]->volume_pan_left = left;
1085 channels_[channel]->volume_pan_right = right;
1086 return 0;
1087 }
1088 WEBRTC_FUNC(GetOutputVolumePan, (int channel, float& left, float& right)) {
1089 WEBRTC_CHECK_CHANNEL(channel);
1090 left = channels_[channel]->volume_pan_left;
1091 right = channels_[channel]->volume_pan_right;
1092 return 0;
1093 }
1094
1095 // webrtc::VoEAudioProcessing
1096 WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) {
1097 ns_enabled_ = enable;
1098 ns_mode_ = mode;
1099 return 0;
1100 }
1101 WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) {
1102 enabled = ns_enabled_;
1103 mode = ns_mode_;
1104 return 0;
1105 }
1106
1107 WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
1108 agc_enabled_ = enable;
1109 agc_mode_ = mode;
1110 return 0;
1111 }
1112 WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) {
1113 enabled = agc_enabled_;
1114 mode = agc_mode_;
1115 return 0;
1116 }
1117
1118 WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
1119 agc_config_ = config;
1120 return 0;
1121 }
1122 WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) {
1123 config = agc_config_;
1124 return 0;
1125 }
1126 WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) {
1127 ec_enabled_ = enable;
1128 ec_mode_ = mode;
1129 return 0;
1130 }
1131 WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) {
1132 enabled = ec_enabled_;
1133 mode = ec_mode_;
1134 return 0;
1135 }
1136 WEBRTC_STUB(EnableDriftCompensation, (bool enable))
1137 WEBRTC_BOOL_STUB(DriftCompensationEnabled, ())
1138 WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset))
1139 WEBRTC_STUB(DelayOffsetMs, ());
1140 WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) {
1141 aecm_mode_ = mode;
1142 cng_enabled_ = enableCNG;
1143 return 0;
1144 }
1145 WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) {
1146 mode = aecm_mode_;
1147 enabledCNG = cng_enabled_;
1148 return 0;
1149 }
1150 WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode));
1151 WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled,
1152 webrtc::NsModes& mode));
wu@webrtc.org97077a32013-10-25 21:18:33 +00001153 WEBRTC_FUNC(SetRxAgcStatus, (int channel, bool enable,
1154 webrtc::AgcModes mode)) {
1155 channels_[channel]->rx_agc_enabled = enable;
1156 channels_[channel]->rx_agc_mode = mode;
1157 return 0;
1158 }
1159 WEBRTC_FUNC(GetRxAgcStatus, (int channel, bool& enabled,
1160 webrtc::AgcModes& mode)) {
1161 enabled = channels_[channel]->rx_agc_enabled;
1162 mode = channels_[channel]->rx_agc_mode;
1163 return 0;
1164 }
1165
1166 WEBRTC_FUNC(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)) {
1167 channels_[channel]->rx_agc_config = config;
1168 return 0;
1169 }
1170 WEBRTC_FUNC(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)) {
1171 config = channels_[channel]->rx_agc_config;
1172 return 0;
1173 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001174
1175 WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
1176 WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
1177 WEBRTC_STUB(VoiceActivityIndicator, (int channel));
1178 WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) {
1179 ec_metrics_enabled_ = enable;
1180 return 0;
1181 }
1182 WEBRTC_FUNC(GetEcMetricsStatus, (bool& enabled)) {
1183 enabled = ec_metrics_enabled_;
1184 return 0;
1185 }
1186 WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
bjornv@webrtc.orgcc64a9c2015-02-05 12:52:44 +00001187 WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std,
1188 float& fraction_poor_delays));
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001189
1190 WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
wu@webrtc.org9caf2762013-12-11 18:25:07 +00001191 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001192 WEBRTC_STUB(StopDebugRecording, ());
1193
1194 WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
1195 typing_detection_enabled_ = enable;
1196 return 0;
1197 }
1198 WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) {
1199 enabled = typing_detection_enabled_;
1200 return 0;
1201 }
1202
1203 WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
1204 WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
1205 int costPerTyping,
1206 int reportingThreshold,
1207 int penaltyDecay,
1208 int typeEventDelay));
1209 int EnableHighPassFilter(bool enable) {
1210 highpass_filter_enabled_ = enable;
1211 return 0;
1212 }
1213 bool IsHighPassFilterEnabled() {
1214 return highpass_filter_enabled_;
1215 }
1216 bool IsStereoChannelSwappingEnabled() {
1217 return stereo_swapping_enabled_;
1218 }
1219 void EnableStereoChannelSwapping(bool enable) {
1220 stereo_swapping_enabled_ = enable;
1221 }
1222 bool WasSendTelephoneEventCalled(int channel, int event_code, int length_ms) {
1223 return (channels_[channel]->dtmf_info.dtmf_event_code == event_code &&
1224 channels_[channel]->dtmf_info.dtmf_out_of_band == true &&
1225 channels_[channel]->dtmf_info.dtmf_length_ms == length_ms);
1226 }
1227 bool WasPlayDtmfToneCalled(int event_code, int length_ms) {
1228 return (dtmf_info_.dtmf_event_code == event_code &&
1229 dtmf_info_.dtmf_length_ms == length_ms);
1230 }
1231 // webrtc::VoEExternalMedia
1232 WEBRTC_FUNC(RegisterExternalMediaProcessing,
1233 (int channel, webrtc::ProcessingTypes type,
1234 webrtc::VoEMediaProcess& processObject)) {
1235 WEBRTC_CHECK_CHANNEL(channel);
1236 if (channels_[channel]->media_processor_registered) {
1237 return -1;
1238 }
1239 channels_[channel]->media_processor_registered = true;
1240 media_processor_ = &processObject;
1241 return 0;
1242 }
1243 WEBRTC_FUNC(DeRegisterExternalMediaProcessing,
1244 (int channel, webrtc::ProcessingTypes type)) {
1245 WEBRTC_CHECK_CHANNEL(channel);
1246 if (!channels_[channel]->media_processor_registered) {
1247 return -1;
1248 }
1249 channels_[channel]->media_processor_registered = false;
1250 media_processor_ = NULL;
1251 return 0;
1252 }
1253 WEBRTC_STUB(SetExternalRecordingStatus, (bool enable));
1254 WEBRTC_STUB(SetExternalPlayoutStatus, (bool enable));
1255 WEBRTC_STUB(ExternalRecordingInsertData,
1256 (const int16_t speechData10ms[], int lengthSamples,
1257 int samplingFreqHz, int current_delay_ms));
1258 WEBRTC_STUB(ExternalPlayoutGetData,
1259 (int16_t speechData10ms[], int samplingFreqHz,
1260 int current_delay_ms, int& lengthSamples));
1261 WEBRTC_STUB(GetAudioFrame, (int channel, int desired_sample_rate_hz,
1262 webrtc::AudioFrame* frame));
1263 WEBRTC_STUB(SetExternalMixing, (int channel, bool enable));
1264
1265 private:
1266 int GetNumDevices(int& num) {
1267#ifdef WIN32
1268 num = 1;
1269#else
1270 // On non-Windows platforms VE adds a special entry for the default device,
1271 // so if there is one physical device then there are two entries in the
1272 // list.
1273 num = 2;
1274#endif
1275 return 0;
1276 }
1277
1278 int GetDeviceName(int i, char* name, char* guid) {
1279 const char *s;
1280#ifdef WIN32
1281 if (0 == i) {
1282 s = kFakeDeviceName;
1283 } else {
1284 return -1;
1285 }
1286#else
1287 // See comment above.
1288 if (0 == i) {
1289 s = kFakeDefaultDeviceName;
1290 } else if (1 == i) {
1291 s = kFakeDeviceName;
1292 } else {
1293 return -1;
1294 }
1295#endif
1296 strcpy(name, s);
1297 guid[0] = '\0';
1298 return 0;
1299 }
1300
1301 bool inited_;
1302 int last_channel_;
1303 std::map<int, Channel*> channels_;
1304 bool fail_create_channel_;
1305 const cricket::AudioCodec* const* codecs_;
1306 int num_codecs_;
wu@webrtc.org05e7b442014-04-01 17:44:24 +00001307 int num_set_send_codecs_; // how many times we call SetSendCodec().
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001308 bool ec_enabled_;
1309 bool ec_metrics_enabled_;
1310 bool cng_enabled_;
1311 bool ns_enabled_;
1312 bool agc_enabled_;
1313 bool highpass_filter_enabled_;
1314 bool stereo_swapping_enabled_;
1315 bool typing_detection_enabled_;
1316 webrtc::EcModes ec_mode_;
1317 webrtc::AecmModes aecm_mode_;
1318 webrtc::NsModes ns_mode_;
1319 webrtc::AgcModes agc_mode_;
1320 webrtc::AgcConfig agc_config_;
1321 webrtc::VoiceEngineObserver* observer_;
1322 int playout_fail_channel_;
1323 int send_fail_channel_;
1324 bool fail_start_recording_microphone_;
1325 bool recording_microphone_;
wu@webrtc.org97077a32013-10-25 21:18:33 +00001326 int recording_sample_rate_;
1327 int playout_sample_rate_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001328 DtmfInfo dtmf_info_;
1329 webrtc::VoEMediaProcess* media_processor_;
buildbot@webrtc.orga8d8ad22014-07-16 14:23:08 +00001330 FakeAudioProcessing audio_processing_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001331};
1332
henrike@webrtc.org79047f92014-03-06 23:46:59 +00001333#undef WEBRTC_CHECK_HEADER_EXTENSION_ID
1334
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001335} // namespace cricket
1336
1337#endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_