blob: 809816bc224e25abd139fb152a571c84a1407b97 [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
35
36#include "talk/base/basictypes.h"
wu@webrtc.org9caf2762013-12-11 18:25:07 +000037#include "talk/base/gunit.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000038#include "talk/base/stringutils.h"
39#include "talk/media/base/codec.h"
40#include "talk/media/base/voiceprocessor.h"
41#include "talk/media/webrtc/fakewebrtccommon.h"
42#include "talk/media/webrtc/webrtcvoe.h"
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000043#include "webrtc/modules/audio_coding/main/interface/audio_coding_module.h"
44#include "webrtc/common.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000045
46namespace 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
62
63class FakeWebRtcVoiceEngine
64 : public webrtc::VoEAudioProcessing,
65 public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
66 public webrtc::VoEFile, public webrtc::VoEHardware,
67 public webrtc::VoEExternalMedia, public webrtc::VoENetEqStats,
68 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
69 public webrtc::VoEVideoSync, public webrtc::VoEVolumeControl {
70 public:
71 struct DtmfInfo {
72 DtmfInfo()
73 : dtmf_event_code(-1),
74 dtmf_out_of_band(false),
75 dtmf_length_ms(-1) {}
76 int dtmf_event_code;
77 bool dtmf_out_of_band;
78 int dtmf_length_ms;
79 };
80 struct Channel {
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +000081 explicit Channel(bool use_experimental_acm)
henrike@webrtc.org28e20752013-07-10 00:45:36 +000082 : external_transport(false),
83 send(false),
84 playout(false),
85 volume_scale(1.0),
86 volume_pan_left(1.0),
87 volume_pan_right(1.0),
88 file(false),
89 vad(false),
90 fec(false),
91 nack(false),
92 media_processor_registered(false),
wu@webrtc.org97077a32013-10-25 21:18:33 +000093 rx_agc_enabled(false),
94 rx_agc_mode(webrtc::kAgcDefault),
henrike@webrtc.org28e20752013-07-10 00:45:36 +000095 cn8_type(13),
96 cn16_type(105),
97 dtmf_type(106),
98 fec_type(117),
99 nack_max_packets(0),
100 send_ssrc(0),
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000101 level_header_ext_(-1),
102 using_experimental_acm(use_experimental_acm) {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000103 memset(&send_codec, 0, sizeof(send_codec));
wu@webrtc.org97077a32013-10-25 21:18:33 +0000104 memset(&rx_agc_config, 0, sizeof(rx_agc_config));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000105 }
106 bool external_transport;
107 bool send;
108 bool playout;
109 float volume_scale;
110 float volume_pan_left;
111 float volume_pan_right;
112 bool file;
113 bool vad;
114 bool fec;
115 bool nack;
116 bool media_processor_registered;
wu@webrtc.org97077a32013-10-25 21:18:33 +0000117 bool rx_agc_enabled;
118 webrtc::AgcModes rx_agc_mode;
119 webrtc::AgcConfig rx_agc_config;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120 int cn8_type;
121 int cn16_type;
122 int dtmf_type;
123 int fec_type;
124 int nack_max_packets;
125 uint32 send_ssrc;
126 int level_header_ext_;
127 DtmfInfo dtmf_info;
128 std::vector<webrtc::CodecInst> recv_codecs;
129 webrtc::CodecInst send_codec;
130 std::list<std::string> packets;
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000131 bool using_experimental_acm;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000132 };
133
134 FakeWebRtcVoiceEngine(const cricket::AudioCodec* const* codecs,
135 int num_codecs)
136 : inited_(false),
137 last_channel_(-1),
138 fail_create_channel_(false),
139 codecs_(codecs),
140 num_codecs_(num_codecs),
141 ec_enabled_(false),
142 ec_metrics_enabled_(false),
143 cng_enabled_(false),
144 ns_enabled_(false),
145 agc_enabled_(false),
146 highpass_filter_enabled_(false),
147 stereo_swapping_enabled_(false),
148 typing_detection_enabled_(false),
149 ec_mode_(webrtc::kEcDefault),
150 aecm_mode_(webrtc::kAecmSpeakerphone),
151 ns_mode_(webrtc::kNsDefault),
152 agc_mode_(webrtc::kAgcDefault),
153 observer_(NULL),
154 playout_fail_channel_(-1),
155 send_fail_channel_(-1),
156 fail_start_recording_microphone_(false),
157 recording_microphone_(false),
wu@webrtc.org97077a32013-10-25 21:18:33 +0000158 recording_sample_rate_(-1),
159 playout_sample_rate_(-1),
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000160 media_processor_(NULL) {
161 memset(&agc_config_, 0, sizeof(agc_config_));
162 }
163 ~FakeWebRtcVoiceEngine() {
164 // Ought to have all been deleted by the WebRtcVoiceMediaChannel
165 // destructors, but just in case ...
166 for (std::map<int, Channel*>::const_iterator i = channels_.begin();
167 i != channels_.end(); ++i) {
168 delete i->second;
169 }
170 }
171
172 bool IsExternalMediaProcessorRegistered() const {
173 return media_processor_ != NULL;
174 }
175 bool IsInited() const { return inited_; }
176 int GetLastChannel() const { return last_channel_; }
wu@webrtc.org9dba5252013-08-05 20:36:57 +0000177 int GetChannelFromLocalSsrc(uint32 local_ssrc) const {
178 for (std::map<int, Channel*>::const_iterator iter = channels_.begin();
179 iter != channels_.end(); ++iter) {
180 if (local_ssrc == iter->second->send_ssrc)
181 return iter->first;
182 }
183 return -1;
184 }
wu@webrtc.org9caf2762013-12-11 18:25:07 +0000185 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000186 bool GetPlayout(int channel) {
187 return channels_[channel]->playout;
188 }
189 bool GetSend(int channel) {
190 return channels_[channel]->send;
191 }
192 bool GetRecordingMicrophone() {
193 return recording_microphone_;
194 }
195 bool GetVAD(int channel) {
196 return channels_[channel]->vad;
197 }
198 bool GetFEC(int channel) {
199 return channels_[channel]->fec;
200 }
201 bool GetNACK(int channel) {
202 return channels_[channel]->nack;
203 }
204 int GetNACKMaxPackets(int channel) {
205 return channels_[channel]->nack_max_packets;
206 }
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000207 bool IsUsingExperimentalAcm(int channel) {
208 WEBRTC_ASSERT_CHANNEL(channel);
209 return channels_[channel]->using_experimental_acm;
210 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000211 int GetSendCNPayloadType(int channel, bool wideband) {
212 return (wideband) ?
213 channels_[channel]->cn16_type :
214 channels_[channel]->cn8_type;
215 }
216 int GetSendTelephoneEventPayloadType(int channel) {
217 return channels_[channel]->dtmf_type;
218 }
219 int GetSendFECPayloadType(int channel) {
220 return channels_[channel]->fec_type;
221 }
222 bool CheckPacket(int channel, const void* data, size_t len) {
223 bool result = !CheckNoPacket(channel);
224 if (result) {
225 std::string packet = channels_[channel]->packets.front();
226 result = (packet == std::string(static_cast<const char*>(data), len));
227 channels_[channel]->packets.pop_front();
228 }
229 return result;
230 }
231 bool CheckNoPacket(int channel) {
232 return channels_[channel]->packets.empty();
233 }
234 void TriggerCallbackOnError(int channel_num, int err_code) {
235 ASSERT(observer_ != NULL);
236 observer_->CallbackOnError(channel_num, err_code);
237 }
238 void set_playout_fail_channel(int channel) {
239 playout_fail_channel_ = channel;
240 }
241 void set_send_fail_channel(int channel) {
242 send_fail_channel_ = channel;
243 }
244 void set_fail_start_recording_microphone(
245 bool fail_start_recording_microphone) {
246 fail_start_recording_microphone_ = fail_start_recording_microphone;
247 }
248 void set_fail_create_channel(bool fail_create_channel) {
249 fail_create_channel_ = fail_create_channel;
250 }
251 void TriggerProcessPacket(MediaProcessorDirection direction) {
252 webrtc::ProcessingTypes pt =
253 (direction == cricket::MPD_TX) ?
254 webrtc::kRecordingPerChannel : webrtc::kPlaybackAllChannelsMixed;
255 if (media_processor_ != NULL) {
256 media_processor_->Process(0,
257 pt,
258 NULL,
259 0,
260 0,
261 true);
262 }
263 }
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000264 int AddChannel(bool use_experimental_acm) {
wu@webrtc.org364f2042013-11-20 21:49:41 +0000265 if (fail_create_channel_) {
266 return -1;
267 }
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000268 Channel* ch = new Channel(use_experimental_acm);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000269 for (int i = 0; i < NumOfCodecs(); ++i) {
270 webrtc::CodecInst codec;
271 GetCodec(i, codec);
272 ch->recv_codecs.push_back(codec);
273 }
274 channels_[++last_channel_] = ch;
275 return last_channel_;
276 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000277
278 WEBRTC_STUB(Release, ());
279
280 // webrtc::VoEBase
281 WEBRTC_FUNC(RegisterVoiceEngineObserver, (
282 webrtc::VoiceEngineObserver& observer)) {
283 observer_ = &observer;
284 return 0;
285 }
286 WEBRTC_STUB(DeRegisterVoiceEngineObserver, ());
287 WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm,
288 webrtc::AudioProcessing* audioproc)) {
289 inited_ = true;
290 return 0;
291 }
292 WEBRTC_FUNC(Terminate, ()) {
293 inited_ = false;
294 return 0;
295 }
296 virtual webrtc::AudioProcessing* audio_processing() OVERRIDE {
297 return NULL;
298 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000299 WEBRTC_FUNC(CreateChannel, ()) {
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000300 return AddChannel(false);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000301 }
sergeyu@chromium.org5bc25c42013-12-05 00:24:06 +0000302 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) {
303 talk_base::scoped_ptr<webrtc::AudioCodingModule> acm(
304 config.Get<webrtc::AudioCodingModuleFactory>().Create(0));
305 return AddChannel(strcmp(acm->Version(), webrtc::kExperimentalAcmVersion)
306 == 0);
wu@webrtc.org364f2042013-11-20 21:49:41 +0000307 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000308 WEBRTC_FUNC(DeleteChannel, (int channel)) {
309 WEBRTC_CHECK_CHANNEL(channel);
310 delete channels_[channel];
311 channels_.erase(channel);
312 return 0;
313 }
314 WEBRTC_STUB(StartReceive, (int channel));
315 WEBRTC_FUNC(StartPlayout, (int channel)) {
316 if (playout_fail_channel_ != channel) {
317 WEBRTC_CHECK_CHANNEL(channel);
318 channels_[channel]->playout = true;
319 return 0;
320 } else {
321 // When playout_fail_channel_ == channel, fail the StartPlayout on this
322 // channel.
323 return -1;
324 }
325 }
326 WEBRTC_FUNC(StartSend, (int channel)) {
327 if (send_fail_channel_ != channel) {
328 WEBRTC_CHECK_CHANNEL(channel);
329 channels_[channel]->send = true;
330 return 0;
331 } else {
332 // When send_fail_channel_ == channel, fail the StartSend on this
333 // channel.
334 return -1;
335 }
336 }
337 WEBRTC_STUB(StopReceive, (int channel));
338 WEBRTC_FUNC(StopPlayout, (int channel)) {
339 WEBRTC_CHECK_CHANNEL(channel);
340 channels_[channel]->playout = false;
341 return 0;
342 }
343 WEBRTC_FUNC(StopSend, (int channel)) {
344 WEBRTC_CHECK_CHANNEL(channel);
345 channels_[channel]->send = false;
346 return 0;
347 }
348 WEBRTC_STUB(GetVersion, (char version[1024]));
349 WEBRTC_STUB(LastError, ());
350 WEBRTC_STUB(SetOnHoldStatus, (int, bool, webrtc::OnHoldModes));
351 WEBRTC_STUB(GetOnHoldStatus, (int, bool&, webrtc::OnHoldModes&));
352 WEBRTC_STUB(SetNetEQPlayoutMode, (int, webrtc::NetEqModes));
353 WEBRTC_STUB(GetNetEQPlayoutMode, (int, webrtc::NetEqModes&));
354
355 // webrtc::VoECodec
356 WEBRTC_FUNC(NumOfCodecs, ()) {
357 return num_codecs_;
358 }
359 WEBRTC_FUNC(GetCodec, (int index, webrtc::CodecInst& codec)) {
360 if (index < 0 || index >= NumOfCodecs()) {
361 return -1;
362 }
363 const cricket::AudioCodec& c(*codecs_[index]);
364 codec.pltype = c.id;
365 talk_base::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
366 codec.plfreq = c.clockrate;
367 codec.pacsize = 0;
368 codec.channels = c.channels;
369 codec.rate = c.bitrate;
370 return 0;
371 }
372 WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) {
373 WEBRTC_CHECK_CHANNEL(channel);
374 channels_[channel]->send_codec = codec;
375 return 0;
376 }
377 WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
378 WEBRTC_CHECK_CHANNEL(channel);
379 codec = channels_[channel]->send_codec;
380 return 0;
381 }
382 WEBRTC_STUB(SetSecondarySendCodec, (int channel,
383 const webrtc::CodecInst& codec,
384 int red_payload_type));
385 WEBRTC_STUB(RemoveSecondarySendCodec, (int channel));
386 WEBRTC_STUB(GetSecondarySendCodec, (int channel,
387 webrtc::CodecInst& codec));
388 WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec));
389 WEBRTC_STUB(SetAMREncFormat, (int channel, webrtc::AmrMode mode));
390 WEBRTC_STUB(SetAMRDecFormat, (int channel, webrtc::AmrMode mode));
391 WEBRTC_STUB(SetAMRWbEncFormat, (int channel, webrtc::AmrMode mode));
392 WEBRTC_STUB(SetAMRWbDecFormat, (int channel, webrtc::AmrMode mode));
393 WEBRTC_STUB(SetISACInitTargetRate, (int channel, int rateBps,
394 bool useFixedFrameSize));
395 WEBRTC_STUB(SetISACMaxRate, (int channel, int rateBps));
396 WEBRTC_STUB(SetISACMaxPayloadSize, (int channel, int sizeBytes));
397 WEBRTC_FUNC(SetRecPayloadType, (int channel,
398 const webrtc::CodecInst& codec)) {
399 WEBRTC_CHECK_CHANNEL(channel);
400 Channel* ch = channels_[channel];
401 if (ch->playout)
402 return -1; // Channel is in use.
403 // Check if something else already has this slot.
404 if (codec.pltype != -1) {
405 for (std::vector<webrtc::CodecInst>::iterator it =
406 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
407 if (it->pltype == codec.pltype &&
408 _stricmp(it->plname, codec.plname) != 0) {
409 return -1;
410 }
411 }
412 }
413 // Otherwise try to find this codec and update its payload type.
414 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
415 it != ch->recv_codecs.end(); ++it) {
416 if (strcmp(it->plname, codec.plname) == 0 &&
417 it->plfreq == codec.plfreq) {
418 it->pltype = codec.pltype;
419 it->channels = codec.channels;
420 return 0;
421 }
422 }
423 return -1; // not found
424 }
425 WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type,
426 webrtc::PayloadFrequencies frequency)) {
427 WEBRTC_CHECK_CHANNEL(channel);
428 if (frequency == webrtc::kFreq8000Hz) {
429 channels_[channel]->cn8_type = type;
430 } else if (frequency == webrtc::kFreq16000Hz) {
431 channels_[channel]->cn16_type = type;
432 }
433 return 0;
434 }
435 WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) {
436 WEBRTC_CHECK_CHANNEL(channel);
437 Channel* ch = channels_[channel];
438 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
439 it != ch->recv_codecs.end(); ++it) {
440 if (strcmp(it->plname, codec.plname) == 0 &&
441 it->plfreq == codec.plfreq &&
442 it->channels == codec.channels &&
443 it->pltype != -1) {
444 codec.pltype = it->pltype;
445 return 0;
446 }
447 }
448 return -1; // not found
449 }
450 WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode,
451 bool disableDTX)) {
452 WEBRTC_CHECK_CHANNEL(channel);
453 if (channels_[channel]->send_codec.channels == 2) {
454 // Replicating VoE behavior; VAD cannot be enabled for stereo.
455 return -1;
456 }
457 channels_[channel]->vad = enable;
458 return 0;
459 }
460 WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
461 webrtc::VadModes& mode, bool& disabledDTX));
462
463 // webrtc::VoEDtmf
464 WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
465 bool out_of_band = true, int length_ms = 160, int attenuation_db = 10)) {
466 channels_[channel]->dtmf_info.dtmf_event_code = event_code;
467 channels_[channel]->dtmf_info.dtmf_out_of_band = out_of_band;
468 channels_[channel]->dtmf_info.dtmf_length_ms = length_ms;
469 return 0;
470 }
471
472 WEBRTC_FUNC(SetSendTelephoneEventPayloadType,
473 (int channel, unsigned char type)) {
474 channels_[channel]->dtmf_type = type;
475 return 0;
476 };
477 WEBRTC_STUB(GetSendTelephoneEventPayloadType,
478 (int channel, unsigned char& type));
479
480 WEBRTC_STUB(SetDtmfFeedbackStatus, (bool enable, bool directFeedback));
481 WEBRTC_STUB(GetDtmfFeedbackStatus, (bool& enabled, bool& directFeedback));
482 WEBRTC_STUB(SetDtmfPlayoutStatus, (int channel, bool enable));
483 WEBRTC_STUB(GetDtmfPlayoutStatus, (int channel, bool& enabled));
484
485
486 WEBRTC_FUNC(PlayDtmfTone,
487 (int event_code, int length_ms = 200, int attenuation_db = 10)) {
488 dtmf_info_.dtmf_event_code = event_code;
489 dtmf_info_.dtmf_length_ms = length_ms;
490 return 0;
491 }
492 WEBRTC_STUB(StartPlayingDtmfTone,
493 (int eventCode, int attenuationDb = 10));
494 WEBRTC_STUB(StopPlayingDtmfTone, ());
495
496 // webrtc::VoEFile
497 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, const char* fileNameUTF8,
498 bool loop, webrtc::FileFormats format,
499 float volumeScaling, int startPointMs,
500 int stopPointMs)) {
501 WEBRTC_CHECK_CHANNEL(channel);
502 channels_[channel]->file = true;
503 return 0;
504 }
505 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, webrtc::InStream* stream,
506 webrtc::FileFormats format,
507 float volumeScaling, int startPointMs,
508 int stopPointMs)) {
509 WEBRTC_CHECK_CHANNEL(channel);
510 channels_[channel]->file = true;
511 return 0;
512 }
513 WEBRTC_FUNC(StopPlayingFileLocally, (int channel)) {
514 WEBRTC_CHECK_CHANNEL(channel);
515 channels_[channel]->file = false;
516 return 0;
517 }
518 WEBRTC_FUNC(IsPlayingFileLocally, (int channel)) {
519 WEBRTC_CHECK_CHANNEL(channel);
520 return (channels_[channel]->file) ? 1 : 0;
521 }
522 WEBRTC_STUB(ScaleLocalFilePlayout, (int channel, float scale));
523 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
524 const char* fileNameUTF8,
525 bool loop,
526 bool mixWithMicrophone,
527 webrtc::FileFormats format,
528 float volumeScaling));
529 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
530 webrtc::InStream* stream,
531 bool mixWithMicrophone,
532 webrtc::FileFormats format,
533 float volumeScaling));
534 WEBRTC_STUB(StopPlayingFileAsMicrophone, (int channel));
535 WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel));
536 WEBRTC_STUB(ScaleFileAsMicrophonePlayout, (int channel, float scale));
537 WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8,
538 webrtc::CodecInst* compression,
539 int maxSizeBytes));
540 WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream,
541 webrtc::CodecInst* compression));
542 WEBRTC_STUB(StopRecordingPlayout, (int channel));
543 WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8,
544 webrtc::CodecInst* compression,
545 int maxSizeBytes)) {
546 if (fail_start_recording_microphone_) {
547 return -1;
548 }
549 recording_microphone_ = true;
550 return 0;
551 }
552 WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream,
553 webrtc::CodecInst* compression)) {
554 if (fail_start_recording_microphone_) {
555 return -1;
556 }
557 recording_microphone_ = true;
558 return 0;
559 }
560 WEBRTC_FUNC(StopRecordingMicrophone, ()) {
561 if (!recording_microphone_) {
562 return -1;
563 }
564 recording_microphone_ = false;
565 return 0;
566 }
567 WEBRTC_STUB(ConvertPCMToWAV, (const char* fileNameInUTF8,
568 const char* fileNameOutUTF8));
569 WEBRTC_STUB(ConvertPCMToWAV, (webrtc::InStream* streamIn,
570 webrtc::OutStream* streamOut));
571 WEBRTC_STUB(ConvertWAVToPCM, (const char* fileNameInUTF8,
572 const char* fileNameOutUTF8));
573 WEBRTC_STUB(ConvertWAVToPCM, (webrtc::InStream* streamIn,
574 webrtc::OutStream* streamOut));
575 WEBRTC_STUB(ConvertPCMToCompressed, (const char* fileNameInUTF8,
576 const char* fileNameOutUTF8,
577 webrtc::CodecInst* compression));
578 WEBRTC_STUB(ConvertPCMToCompressed, (webrtc::InStream* streamIn,
579 webrtc::OutStream* streamOut,
580 webrtc::CodecInst* compression));
581 WEBRTC_STUB(ConvertCompressedToPCM, (const char* fileNameInUTF8,
582 const char* fileNameOutUTF8));
583 WEBRTC_STUB(ConvertCompressedToPCM, (webrtc::InStream* streamIn,
584 webrtc::OutStream* streamOut));
585 WEBRTC_STUB(GetFileDuration, (const char* fileNameUTF8, int& durationMs,
586 webrtc::FileFormats format));
587 WEBRTC_STUB(GetPlaybackPosition, (int channel, int& positionMs));
588
589 // webrtc::VoEHardware
590 WEBRTC_STUB(GetCPULoad, (int&));
591 WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) {
592 return GetNumDevices(num);
593 }
594 WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) {
595 return GetNumDevices(num);
596 }
597 WEBRTC_FUNC(GetRecordingDeviceName, (int i, char* name, char* guid)) {
598 return GetDeviceName(i, name, guid);
599 }
600 WEBRTC_FUNC(GetPlayoutDeviceName, (int i, char* name, char* guid)) {
601 return GetDeviceName(i, name, guid);
602 }
603 WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel));
604 WEBRTC_STUB(SetPlayoutDevice, (int));
605 WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers));
606 WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&));
607 WEBRTC_STUB(GetPlayoutDeviceStatus, (bool&));
608 WEBRTC_STUB(GetRecordingDeviceStatus, (bool&));
609 WEBRTC_STUB(ResetAudioDevice, ());
610 WEBRTC_STUB(AudioDeviceControl, (unsigned int, unsigned int, unsigned int));
611 WEBRTC_STUB(SetLoudspeakerStatus, (bool enable));
612 WEBRTC_STUB(GetLoudspeakerStatus, (bool& enabled));
wu@webrtc.org97077a32013-10-25 21:18:33 +0000613 WEBRTC_FUNC(SetRecordingSampleRate, (unsigned int samples_per_sec)) {
614 recording_sample_rate_ = samples_per_sec;
615 return 0;
616 }
617 WEBRTC_FUNC_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)) {
618 *samples_per_sec = recording_sample_rate_;
619 return 0;
620 }
621 WEBRTC_FUNC(SetPlayoutSampleRate, (unsigned int samples_per_sec)) {
622 playout_sample_rate_ = samples_per_sec;
623 return 0;
624 }
625 WEBRTC_FUNC_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)) {
626 *samples_per_sec = playout_sample_rate_;
627 return 0;
628 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000629 WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
630 virtual bool BuiltInAECIsEnabled() const { return true; }
631
632 // webrtc::VoENetEqStats
633 WEBRTC_STUB(GetNetworkStatistics, (int, webrtc::NetworkStatistics&));
634
635 // webrtc::VoENetwork
636 WEBRTC_FUNC(RegisterExternalTransport, (int channel,
637 webrtc::Transport& transport)) {
638 WEBRTC_CHECK_CHANNEL(channel);
639 channels_[channel]->external_transport = true;
640 return 0;
641 }
642 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) {
643 WEBRTC_CHECK_CHANNEL(channel);
644 channels_[channel]->external_transport = false;
645 return 0;
646 }
647 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
648 unsigned int length)) {
649 WEBRTC_CHECK_CHANNEL(channel);
650 if (!channels_[channel]->external_transport) return -1;
651 channels_[channel]->packets.push_back(
652 std::string(static_cast<const char*>(data), length));
653 return 0;
654 }
655 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data,
656 unsigned int length));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000657
658 // webrtc::VoERTP_RTCP
659 WEBRTC_STUB(RegisterRTPObserver, (int channel,
660 webrtc::VoERTPObserver& observer));
661 WEBRTC_STUB(DeRegisterRTPObserver, (int channel));
662 WEBRTC_STUB(RegisterRTCPObserver, (int channel,
663 webrtc::VoERTCPObserver& observer));
664 WEBRTC_STUB(DeRegisterRTCPObserver, (int channel));
665 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
666 WEBRTC_CHECK_CHANNEL(channel);
667 channels_[channel]->send_ssrc = ssrc;
668 return 0;
669 }
670 WEBRTC_FUNC(GetLocalSSRC, (int channel, unsigned int& ssrc)) {
671 WEBRTC_CHECK_CHANNEL(channel);
672 ssrc = channels_[channel]->send_ssrc;
673 return 0;
674 }
675 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
676 WEBRTC_FUNC(SetRTPAudioLevelIndicationStatus, (int channel, bool enable,
677 unsigned char id)) {
678 WEBRTC_CHECK_CHANNEL(channel);
679 if (enable && (id < 1 || id > 14)) {
680 // [RFC5285] The 4-bit ID is the local identifier of this element in
681 // the range 1-14 inclusive.
682 return -1;
683 }
684 channels_[channel]->level_header_ext_ = (enable) ? id : -1;
685 return 0;
686 }
687 WEBRTC_FUNC(GetRTPAudioLevelIndicationStatus, (int channel, bool& enabled,
688 unsigned char& id)) {
689 WEBRTC_CHECK_CHANNEL(channel);
690 enabled = (channels_[channel]->level_header_ext_ != -1);
691 id = channels_[channel]->level_header_ext_;
692 return 0;
693 }
694 WEBRTC_STUB(GetRemoteCSRCs, (int channel, unsigned int arrCSRC[15]));
695 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable));
696 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
697 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
698 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
699 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
700 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
701 unsigned int& NTPLow,
702 unsigned int& timestamp,
703 unsigned int& playoutTimestamp,
704 unsigned int* jitter,
705 unsigned short* fractionLost));
706 WEBRTC_STUB(GetRemoteRTCPSenderInfo, (int channel,
707 webrtc::SenderInfo* sender_info));
708 WEBRTC_FUNC(GetRemoteRTCPReportBlocks,
709 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks)) {
710 WEBRTC_CHECK_CHANNEL(channel);
711 webrtc::ReportBlock block;
712 block.source_SSRC = channels_[channel]->send_ssrc;
713 webrtc::CodecInst send_codec = channels_[channel]->send_codec;
714 if (send_codec.pltype >= 0) {
715 block.fraction_lost = (unsigned char)(kFractionLostStatValue * 256);
716 if (send_codec.plfreq / 1000 > 0) {
717 block.interarrival_jitter = kIntStatValue * (send_codec.plfreq / 1000);
718 }
719 block.cumulative_num_packets_lost = kIntStatValue;
720 block.extended_highest_sequence_number = kIntStatValue;
721 receive_blocks->push_back(block);
722 }
723 return 0;
724 }
725 WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (int channel,
726 unsigned char subType,
727 unsigned int name,
728 const char* data,
729 unsigned short dataLength));
730 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
731 unsigned int& maxJitterMs,
732 unsigned int& discardedPackets));
733 WEBRTC_FUNC(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)) {
734 WEBRTC_CHECK_CHANNEL(channel);
735 stats.fractionLost = static_cast<int16>(kIntStatValue);
736 stats.cumulativeLost = kIntStatValue;
737 stats.extendedMax = kIntStatValue;
738 stats.jitterSamples = kIntStatValue;
739 stats.rttMs = kIntStatValue;
740 stats.bytesSent = kIntStatValue;
741 stats.packetsSent = kIntStatValue;
742 stats.bytesReceived = kIntStatValue;
743 stats.packetsReceived = kIntStatValue;
744 return 0;
745 }
746 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
747 WEBRTC_CHECK_CHANNEL(channel);
748 channels_[channel]->fec = enable;
749 channels_[channel]->fec_type = redPayloadtype;
750 return 0;
751 }
752 WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
753 WEBRTC_CHECK_CHANNEL(channel);
754 enable = channels_[channel]->fec;
755 redPayloadtype = channels_[channel]->fec_type;
756 return 0;
757 }
758 WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
759 WEBRTC_CHECK_CHANNEL(channel);
760 channels_[channel]->nack = enable;
761 channels_[channel]->nack_max_packets = maxNoPackets;
762 return 0;
763 }
764 WEBRTC_STUB(StartRTPDump, (int channel, const char* fileNameUTF8,
765 webrtc::RTPDirections direction));
766 WEBRTC_STUB(StopRTPDump, (int channel, webrtc::RTPDirections direction));
767 WEBRTC_STUB(RTPDumpIsActive, (int channel, webrtc::RTPDirections direction));
768 WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType,
769 bool markerBit, const char* payloadData,
770 unsigned short payloadSize));
771 WEBRTC_STUB(GetLastRemoteTimeStamp, (int channel,
772 uint32_t* lastRemoteTimeStamp));
773
774 // webrtc::VoEVideoSync
775 WEBRTC_STUB(GetPlayoutBufferSize, (int& bufferMs));
776 WEBRTC_STUB(GetPlayoutTimestamp, (int channel, unsigned int& timestamp));
wu@webrtc.org822fbd82013-08-15 23:38:54 +0000777 WEBRTC_STUB(GetRtpRtcp, (int, webrtc::RtpRtcp**, webrtc::RtpReceiver**));
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000778 WEBRTC_STUB(SetInitTimestamp, (int channel, unsigned int timestamp));
779 WEBRTC_STUB(SetInitSequenceNumber, (int channel, short sequenceNumber));
780 WEBRTC_STUB(SetMinimumPlayoutDelay, (int channel, int delayMs));
781 WEBRTC_STUB(SetInitialPlayoutDelay, (int channel, int delay_ms));
782 WEBRTC_STUB(GetDelayEstimate, (int channel, int* jitter_buffer_delay_ms,
783 int* playout_buffer_delay_ms));
784 WEBRTC_STUB_CONST(GetLeastRequiredDelayMs, (int channel));
785
786 // webrtc::VoEVolumeControl
787 WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
788 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
789 WEBRTC_STUB(SetSystemOutputMute, (bool));
790 WEBRTC_STUB(GetSystemOutputMute, (bool&));
791 WEBRTC_STUB(SetMicVolume, (unsigned int));
792 WEBRTC_STUB(GetMicVolume, (unsigned int&));
793 WEBRTC_STUB(SetInputMute, (int, bool));
794 WEBRTC_STUB(GetInputMute, (int, bool&));
795 WEBRTC_STUB(SetSystemInputMute, (bool));
796 WEBRTC_STUB(GetSystemInputMute, (bool&));
797 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
798 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
799 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
800 WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&));
801 WEBRTC_FUNC(SetChannelOutputVolumeScaling, (int channel, float scale)) {
802 WEBRTC_CHECK_CHANNEL(channel);
803 channels_[channel]->volume_scale= scale;
804 return 0;
805 }
806 WEBRTC_FUNC(GetChannelOutputVolumeScaling, (int channel, float& scale)) {
807 WEBRTC_CHECK_CHANNEL(channel);
808 scale = channels_[channel]->volume_scale;
809 return 0;
810 }
811 WEBRTC_FUNC(SetOutputVolumePan, (int channel, float left, float right)) {
812 WEBRTC_CHECK_CHANNEL(channel);
813 channels_[channel]->volume_pan_left = left;
814 channels_[channel]->volume_pan_right = right;
815 return 0;
816 }
817 WEBRTC_FUNC(GetOutputVolumePan, (int channel, float& left, float& right)) {
818 WEBRTC_CHECK_CHANNEL(channel);
819 left = channels_[channel]->volume_pan_left;
820 right = channels_[channel]->volume_pan_right;
821 return 0;
822 }
823
824 // webrtc::VoEAudioProcessing
825 WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) {
826 ns_enabled_ = enable;
827 ns_mode_ = mode;
828 return 0;
829 }
830 WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) {
831 enabled = ns_enabled_;
832 mode = ns_mode_;
833 return 0;
834 }
835
836 WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
837 agc_enabled_ = enable;
838 agc_mode_ = mode;
839 return 0;
840 }
841 WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) {
842 enabled = agc_enabled_;
843 mode = agc_mode_;
844 return 0;
845 }
846
847 WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
848 agc_config_ = config;
849 return 0;
850 }
851 WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) {
852 config = agc_config_;
853 return 0;
854 }
855 WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) {
856 ec_enabled_ = enable;
857 ec_mode_ = mode;
858 return 0;
859 }
860 WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) {
861 enabled = ec_enabled_;
862 mode = ec_mode_;
863 return 0;
864 }
865 WEBRTC_STUB(EnableDriftCompensation, (bool enable))
866 WEBRTC_BOOL_STUB(DriftCompensationEnabled, ())
867 WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset))
868 WEBRTC_STUB(DelayOffsetMs, ());
869 WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) {
870 aecm_mode_ = mode;
871 cng_enabled_ = enableCNG;
872 return 0;
873 }
874 WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) {
875 mode = aecm_mode_;
876 enabledCNG = cng_enabled_;
877 return 0;
878 }
879 WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode));
880 WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled,
881 webrtc::NsModes& mode));
wu@webrtc.org97077a32013-10-25 21:18:33 +0000882 WEBRTC_FUNC(SetRxAgcStatus, (int channel, bool enable,
883 webrtc::AgcModes mode)) {
884 channels_[channel]->rx_agc_enabled = enable;
885 channels_[channel]->rx_agc_mode = mode;
886 return 0;
887 }
888 WEBRTC_FUNC(GetRxAgcStatus, (int channel, bool& enabled,
889 webrtc::AgcModes& mode)) {
890 enabled = channels_[channel]->rx_agc_enabled;
891 mode = channels_[channel]->rx_agc_mode;
892 return 0;
893 }
894
895 WEBRTC_FUNC(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)) {
896 channels_[channel]->rx_agc_config = config;
897 return 0;
898 }
899 WEBRTC_FUNC(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)) {
900 config = channels_[channel]->rx_agc_config;
901 return 0;
902 }
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000903
904 WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
905 WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
906 WEBRTC_STUB(VoiceActivityIndicator, (int channel));
907 WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) {
908 ec_metrics_enabled_ = enable;
909 return 0;
910 }
911 WEBRTC_FUNC(GetEcMetricsStatus, (bool& enabled)) {
912 enabled = ec_metrics_enabled_;
913 return 0;
914 }
915 WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
916 WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std));
917
918 WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
wu@webrtc.org9caf2762013-12-11 18:25:07 +0000919#ifdef USE_WEBRTC_DEV_BRANCH
920 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
921#endif
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000922 WEBRTC_STUB(StopDebugRecording, ());
923
924 WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
925 typing_detection_enabled_ = enable;
926 return 0;
927 }
928 WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) {
929 enabled = typing_detection_enabled_;
930 return 0;
931 }
932
933 WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
934 WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
935 int costPerTyping,
936 int reportingThreshold,
937 int penaltyDecay,
938 int typeEventDelay));
939 int EnableHighPassFilter(bool enable) {
940 highpass_filter_enabled_ = enable;
941 return 0;
942 }
943 bool IsHighPassFilterEnabled() {
944 return highpass_filter_enabled_;
945 }
946 bool IsStereoChannelSwappingEnabled() {
947 return stereo_swapping_enabled_;
948 }
949 void EnableStereoChannelSwapping(bool enable) {
950 stereo_swapping_enabled_ = enable;
951 }
952 bool WasSendTelephoneEventCalled(int channel, int event_code, int length_ms) {
953 return (channels_[channel]->dtmf_info.dtmf_event_code == event_code &&
954 channels_[channel]->dtmf_info.dtmf_out_of_band == true &&
955 channels_[channel]->dtmf_info.dtmf_length_ms == length_ms);
956 }
957 bool WasPlayDtmfToneCalled(int event_code, int length_ms) {
958 return (dtmf_info_.dtmf_event_code == event_code &&
959 dtmf_info_.dtmf_length_ms == length_ms);
960 }
961 // webrtc::VoEExternalMedia
962 WEBRTC_FUNC(RegisterExternalMediaProcessing,
963 (int channel, webrtc::ProcessingTypes type,
964 webrtc::VoEMediaProcess& processObject)) {
965 WEBRTC_CHECK_CHANNEL(channel);
966 if (channels_[channel]->media_processor_registered) {
967 return -1;
968 }
969 channels_[channel]->media_processor_registered = true;
970 media_processor_ = &processObject;
971 return 0;
972 }
973 WEBRTC_FUNC(DeRegisterExternalMediaProcessing,
974 (int channel, webrtc::ProcessingTypes type)) {
975 WEBRTC_CHECK_CHANNEL(channel);
976 if (!channels_[channel]->media_processor_registered) {
977 return -1;
978 }
979 channels_[channel]->media_processor_registered = false;
980 media_processor_ = NULL;
981 return 0;
982 }
983 WEBRTC_STUB(SetExternalRecordingStatus, (bool enable));
984 WEBRTC_STUB(SetExternalPlayoutStatus, (bool enable));
985 WEBRTC_STUB(ExternalRecordingInsertData,
986 (const int16_t speechData10ms[], int lengthSamples,
987 int samplingFreqHz, int current_delay_ms));
988 WEBRTC_STUB(ExternalPlayoutGetData,
989 (int16_t speechData10ms[], int samplingFreqHz,
990 int current_delay_ms, int& lengthSamples));
991 WEBRTC_STUB(GetAudioFrame, (int channel, int desired_sample_rate_hz,
992 webrtc::AudioFrame* frame));
993 WEBRTC_STUB(SetExternalMixing, (int channel, bool enable));
994
995 private:
996 int GetNumDevices(int& num) {
997#ifdef WIN32
998 num = 1;
999#else
1000 // On non-Windows platforms VE adds a special entry for the default device,
1001 // so if there is one physical device then there are two entries in the
1002 // list.
1003 num = 2;
1004#endif
1005 return 0;
1006 }
1007
1008 int GetDeviceName(int i, char* name, char* guid) {
1009 const char *s;
1010#ifdef WIN32
1011 if (0 == i) {
1012 s = kFakeDeviceName;
1013 } else {
1014 return -1;
1015 }
1016#else
1017 // See comment above.
1018 if (0 == i) {
1019 s = kFakeDefaultDeviceName;
1020 } else if (1 == i) {
1021 s = kFakeDeviceName;
1022 } else {
1023 return -1;
1024 }
1025#endif
1026 strcpy(name, s);
1027 guid[0] = '\0';
1028 return 0;
1029 }
1030
1031 bool inited_;
1032 int last_channel_;
1033 std::map<int, Channel*> channels_;
1034 bool fail_create_channel_;
1035 const cricket::AudioCodec* const* codecs_;
1036 int num_codecs_;
1037 bool ec_enabled_;
1038 bool ec_metrics_enabled_;
1039 bool cng_enabled_;
1040 bool ns_enabled_;
1041 bool agc_enabled_;
1042 bool highpass_filter_enabled_;
1043 bool stereo_swapping_enabled_;
1044 bool typing_detection_enabled_;
1045 webrtc::EcModes ec_mode_;
1046 webrtc::AecmModes aecm_mode_;
1047 webrtc::NsModes ns_mode_;
1048 webrtc::AgcModes agc_mode_;
1049 webrtc::AgcConfig agc_config_;
1050 webrtc::VoiceEngineObserver* observer_;
1051 int playout_fail_channel_;
1052 int send_fail_channel_;
1053 bool fail_start_recording_microphone_;
1054 bool recording_microphone_;
wu@webrtc.org97077a32013-10-25 21:18:33 +00001055 int recording_sample_rate_;
1056 int playout_sample_rate_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001057 DtmfInfo dtmf_info_;
1058 webrtc::VoEMediaProcess* media_processor_;
1059};
1060
1061} // namespace cricket
1062
1063#endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_