3 * Copyright 2010 Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
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.
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.
28 #ifndef TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
29 #define TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_
35 #include "talk/media/base/codec.h"
36 #include "talk/media/base/rtputils.h"
37 #include "talk/media/base/voiceprocessor.h"
38 #include "talk/media/webrtc/fakewebrtccommon.h"
39 #include "talk/media/webrtc/webrtcvoe.h"
40 #include "webrtc/base/basictypes.h"
41 #include "webrtc/base/gunit.h"
42 #include "webrtc/base/stringutils.h"
43 #ifdef USE_WEBRTC_DEV_BRANCH
44 #include "webrtc/modules/audio_processing/include/audio_processing.h"
53 // Function returning stats will return these values
54 // for all values based on type.
55 const int kIntStatValue = 123;
56 const float kFractionLostStatValue = 0.5;
58 static const char kFakeDefaultDeviceName[] = "Fake Default";
59 static const int kFakeDefaultDeviceId = -1;
60 static const char kFakeDeviceName[] = "Fake Device";
62 static const int kFakeDeviceId = 0;
64 static const int kFakeDeviceId = 1;
67 // Verify the header extension ID, if enabled, is within the bounds specified in
68 // [RFC5285]: 1-14 inclusive.
69 #define WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id) \
71 if (enable && (id < 1 || id > 14)) { \
76 #ifdef USE_WEBRTC_DEV_BRANCH
77 class FakeAudioProcessing : public webrtc::AudioProcessing {
79 FakeAudioProcessing() : experimental_ns_enabled_(false) {}
81 WEBRTC_STUB(Initialize, ())
82 WEBRTC_STUB(Initialize, (
83 int input_sample_rate_hz,
84 int output_sample_rate_hz,
85 int reverse_sample_rate_hz,
86 webrtc::AudioProcessing::ChannelLayout input_layout,
87 webrtc::AudioProcessing::ChannelLayout output_layout,
88 webrtc::AudioProcessing::ChannelLayout reverse_layout));
90 WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) {
91 experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
94 WEBRTC_STUB(set_sample_rate_hz, (int rate));
95 WEBRTC_STUB_CONST(input_sample_rate_hz, ());
96 WEBRTC_STUB_CONST(sample_rate_hz, ());
97 WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
98 WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
99 WEBRTC_STUB_CONST(num_input_channels, ());
100 WEBRTC_STUB_CONST(num_output_channels, ());
101 WEBRTC_STUB_CONST(num_reverse_channels, ());
102 WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted));
103 WEBRTC_BOOL_STUB_CONST(output_will_be_muted, ());
104 WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame));
105 WEBRTC_STUB(ProcessStream, (
106 const float* const* src,
107 int samples_per_channel,
108 int input_sample_rate_hz,
109 webrtc::AudioProcessing::ChannelLayout input_layout,
110 int output_sample_rate_hz,
111 webrtc::AudioProcessing::ChannelLayout output_layout,
112 float* const* dest));
113 WEBRTC_STUB(AnalyzeReverseStream, (webrtc::AudioFrame* frame));
114 WEBRTC_STUB(AnalyzeReverseStream, (
115 const float* const* data,
116 int samples_per_channel,
118 webrtc::AudioProcessing::ChannelLayout layout));
119 WEBRTC_STUB(set_stream_delay_ms, (int delay));
120 WEBRTC_STUB_CONST(stream_delay_ms, ());
121 WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ());
122 WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed));
123 WEBRTC_BOOL_STUB_CONST(stream_key_pressed, ());
124 WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset));
125 WEBRTC_STUB_CONST(delay_offset_ms, ());
126 WEBRTC_STUB(StartDebugRecording, (const char filename[kMaxFilenameSize]));
127 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
128 WEBRTC_STUB(StopDebugRecording, ());
129 virtual webrtc::EchoCancellation* echo_cancellation() const OVERRIDE {
132 virtual webrtc::EchoControlMobile* echo_control_mobile() const OVERRIDE {
135 virtual webrtc::GainControl* gain_control() const OVERRIDE { return NULL; }
136 virtual webrtc::HighPassFilter* high_pass_filter() const OVERRIDE {
139 virtual webrtc::LevelEstimator* level_estimator() const OVERRIDE {
142 virtual webrtc::NoiseSuppression* noise_suppression() const OVERRIDE {
145 virtual webrtc::VoiceDetection* voice_detection() const OVERRIDE {
149 bool experimental_ns_enabled() {
150 return experimental_ns_enabled_;
154 bool experimental_ns_enabled_;
158 class FakeWebRtcVoiceEngine
159 : public webrtc::VoEAudioProcessing,
160 public webrtc::VoEBase, public webrtc::VoECodec, public webrtc::VoEDtmf,
161 public webrtc::VoEFile, public webrtc::VoEHardware,
162 public webrtc::VoEExternalMedia, public webrtc::VoENetEqStats,
163 public webrtc::VoENetwork, public webrtc::VoERTP_RTCP,
164 public webrtc::VoEVideoSync, public webrtc::VoEVolumeControl {
168 : dtmf_event_code(-1),
169 dtmf_out_of_band(false),
170 dtmf_length_ms(-1) {}
172 bool dtmf_out_of_band;
177 : external_transport(false),
181 volume_pan_left(1.0),
182 volume_pan_right(1.0),
188 media_processor_registered(false),
189 rx_agc_enabled(false),
190 rx_agc_mode(webrtc::kAgcDefault),
199 send_audio_level_ext_(-1),
200 receive_audio_level_ext_(-1),
201 send_absolute_sender_time_ext_(-1),
202 receive_absolute_sender_time_ext_(-1) {
203 memset(&send_codec, 0, sizeof(send_codec));
204 memset(&rx_agc_config, 0, sizeof(rx_agc_config));
206 bool external_transport;
210 float volume_pan_left;
211 float volume_pan_right;
217 bool media_processor_registered;
219 webrtc::AgcModes rx_agc_mode;
220 webrtc::AgcConfig rx_agc_config;
225 int nack_max_packets;
226 webrtc::ViENetwork* vie_network;
229 int send_audio_level_ext_;
230 int receive_audio_level_ext_;
231 int send_absolute_sender_time_ext_;
232 int receive_absolute_sender_time_ext_;
234 std::vector<webrtc::CodecInst> recv_codecs;
235 webrtc::CodecInst send_codec;
236 webrtc::PacketTime last_rtp_packet_time;
237 std::list<std::string> packets;
240 FakeWebRtcVoiceEngine(const cricket::AudioCodec* const* codecs,
244 fail_create_channel_(false),
246 num_codecs_(num_codecs),
247 num_set_send_codecs_(0),
249 ec_metrics_enabled_(false),
253 highpass_filter_enabled_(false),
254 stereo_swapping_enabled_(false),
255 typing_detection_enabled_(false),
256 ec_mode_(webrtc::kEcDefault),
257 aecm_mode_(webrtc::kAecmSpeakerphone),
258 ns_mode_(webrtc::kNsDefault),
259 agc_mode_(webrtc::kAgcDefault),
261 playout_fail_channel_(-1),
262 send_fail_channel_(-1),
263 fail_start_recording_microphone_(false),
264 recording_microphone_(false),
265 recording_sample_rate_(-1),
266 playout_sample_rate_(-1),
267 media_processor_(NULL) {
268 memset(&agc_config_, 0, sizeof(agc_config_));
270 ~FakeWebRtcVoiceEngine() {
271 // Ought to have all been deleted by the WebRtcVoiceMediaChannel
272 // destructors, but just in case ...
273 for (std::map<int, Channel*>::const_iterator i = channels_.begin();
274 i != channels_.end(); ++i) {
279 bool IsExternalMediaProcessorRegistered() const {
280 return media_processor_ != NULL;
282 bool IsInited() const { return inited_; }
283 int GetLastChannel() const { return last_channel_; }
284 int GetChannelFromLocalSsrc(uint32 local_ssrc) const {
285 for (std::map<int, Channel*>::const_iterator iter = channels_.begin();
286 iter != channels_.end(); ++iter) {
287 if (local_ssrc == iter->second->send_ssrc)
292 int GetNumChannels() const { return static_cast<int>(channels_.size()); }
293 bool GetPlayout(int channel) {
294 return channels_[channel]->playout;
296 bool GetSend(int channel) {
297 return channels_[channel]->send;
299 bool GetRecordingMicrophone() {
300 return recording_microphone_;
302 bool GetVAD(int channel) {
303 return channels_[channel]->vad;
305 bool GetRED(int channel) {
306 return channels_[channel]->red;
308 bool GetCodecFEC(int channel) {
309 return channels_[channel]->codec_fec;
311 bool GetNACK(int channel) {
312 return channels_[channel]->nack;
314 int GetNACKMaxPackets(int channel) {
315 return channels_[channel]->nack_max_packets;
317 webrtc::ViENetwork* GetViENetwork(int channel) {
318 WEBRTC_ASSERT_CHANNEL(channel);
319 return channels_[channel]->vie_network;
321 int GetVideoChannel(int channel) {
322 WEBRTC_ASSERT_CHANNEL(channel);
323 return channels_[channel]->video_channel;
325 const webrtc::PacketTime& GetLastRtpPacketTime(int channel) {
326 WEBRTC_ASSERT_CHANNEL(channel);
327 return channels_[channel]->last_rtp_packet_time;
329 int GetSendCNPayloadType(int channel, bool wideband) {
331 channels_[channel]->cn16_type :
332 channels_[channel]->cn8_type;
334 int GetSendTelephoneEventPayloadType(int channel) {
335 return channels_[channel]->dtmf_type;
337 int GetSendREDPayloadType(int channel) {
338 return channels_[channel]->red_type;
340 bool CheckPacket(int channel, const void* data, size_t len) {
341 bool result = !CheckNoPacket(channel);
343 std::string packet = channels_[channel]->packets.front();
344 result = (packet == std::string(static_cast<const char*>(data), len));
345 channels_[channel]->packets.pop_front();
349 bool CheckNoPacket(int channel) {
350 return channels_[channel]->packets.empty();
352 void TriggerCallbackOnError(int channel_num, int err_code) {
353 ASSERT(observer_ != NULL);
354 observer_->CallbackOnError(channel_num, err_code);
356 void set_playout_fail_channel(int channel) {
357 playout_fail_channel_ = channel;
359 void set_send_fail_channel(int channel) {
360 send_fail_channel_ = channel;
362 void set_fail_start_recording_microphone(
363 bool fail_start_recording_microphone) {
364 fail_start_recording_microphone_ = fail_start_recording_microphone;
366 void set_fail_create_channel(bool fail_create_channel) {
367 fail_create_channel_ = fail_create_channel;
369 void TriggerProcessPacket(MediaProcessorDirection direction) {
370 webrtc::ProcessingTypes pt =
371 (direction == cricket::MPD_TX) ?
372 webrtc::kRecordingPerChannel : webrtc::kPlaybackAllChannelsMixed;
373 if (media_processor_ != NULL) {
374 media_processor_->Process(0,
383 if (fail_create_channel_) {
386 Channel* ch = new Channel();
387 for (int i = 0; i < NumOfCodecs(); ++i) {
388 webrtc::CodecInst codec;
390 ch->recv_codecs.push_back(codec);
392 channels_[++last_channel_] = ch;
393 return last_channel_;
395 int GetSendRtpExtensionId(int channel, const std::string& extension) {
396 WEBRTC_ASSERT_CHANNEL(channel);
397 if (extension == kRtpAudioLevelHeaderExtension) {
398 return channels_[channel]->send_audio_level_ext_;
399 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) {
400 return channels_[channel]->send_absolute_sender_time_ext_;
404 int GetReceiveRtpExtensionId(int channel, const std::string& extension) {
405 WEBRTC_ASSERT_CHANNEL(channel);
406 if (extension == kRtpAudioLevelHeaderExtension) {
407 return channels_[channel]->receive_audio_level_ext_;
408 } else if (extension == kRtpAbsoluteSenderTimeHeaderExtension) {
409 return channels_[channel]->receive_absolute_sender_time_ext_;
414 int GetNumSetSendCodecs() const { return num_set_send_codecs_; }
416 WEBRTC_STUB(Release, ());
419 WEBRTC_FUNC(RegisterVoiceEngineObserver, (
420 webrtc::VoiceEngineObserver& observer)) {
421 observer_ = &observer;
424 WEBRTC_STUB(DeRegisterVoiceEngineObserver, ());
425 WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm,
426 webrtc::AudioProcessing* audioproc)) {
430 WEBRTC_FUNC(Terminate, ()) {
434 virtual webrtc::AudioProcessing* audio_processing() OVERRIDE {
435 #ifdef USE_WEBRTC_DEV_BRANCH
436 return &audio_processing_;
441 WEBRTC_FUNC(CreateChannel, ()) {
444 WEBRTC_FUNC(CreateChannel, (const webrtc::Config& /*config*/)) {
447 WEBRTC_FUNC(DeleteChannel, (int channel)) {
448 WEBRTC_CHECK_CHANNEL(channel);
449 delete channels_[channel];
450 channels_.erase(channel);
453 WEBRTC_STUB(StartReceive, (int channel));
454 WEBRTC_FUNC(StartPlayout, (int channel)) {
455 if (playout_fail_channel_ != channel) {
456 WEBRTC_CHECK_CHANNEL(channel);
457 channels_[channel]->playout = true;
460 // When playout_fail_channel_ == channel, fail the StartPlayout on this
465 WEBRTC_FUNC(StartSend, (int channel)) {
466 if (send_fail_channel_ != channel) {
467 WEBRTC_CHECK_CHANNEL(channel);
468 channels_[channel]->send = true;
471 // When send_fail_channel_ == channel, fail the StartSend on this
476 WEBRTC_STUB(StopReceive, (int channel));
477 WEBRTC_FUNC(StopPlayout, (int channel)) {
478 WEBRTC_CHECK_CHANNEL(channel);
479 channels_[channel]->playout = false;
482 WEBRTC_FUNC(StopSend, (int channel)) {
483 WEBRTC_CHECK_CHANNEL(channel);
484 channels_[channel]->send = false;
487 WEBRTC_STUB(GetVersion, (char version[1024]));
488 WEBRTC_STUB(LastError, ());
489 WEBRTC_STUB(SetOnHoldStatus, (int, bool, webrtc::OnHoldModes));
490 WEBRTC_STUB(GetOnHoldStatus, (int, bool&, webrtc::OnHoldModes&));
491 WEBRTC_STUB(SetNetEQPlayoutMode, (int, webrtc::NetEqModes));
492 WEBRTC_STUB(GetNetEQPlayoutMode, (int, webrtc::NetEqModes&));
495 WEBRTC_FUNC(NumOfCodecs, ()) {
498 WEBRTC_FUNC(GetCodec, (int index, webrtc::CodecInst& codec)) {
499 if (index < 0 || index >= NumOfCodecs()) {
502 const cricket::AudioCodec& c(*codecs_[index]);
504 rtc::strcpyn(codec.plname, sizeof(codec.plname), c.name.c_str());
505 codec.plfreq = c.clockrate;
507 codec.channels = c.channels;
508 codec.rate = c.bitrate;
511 WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) {
512 WEBRTC_CHECK_CHANNEL(channel);
513 // To match the behavior of the real implementation.
514 if (_stricmp(codec.plname, "telephone-event") == 0 ||
515 _stricmp(codec.plname, "audio/telephone-event") == 0 ||
516 _stricmp(codec.plname, "CN") == 0 ||
517 _stricmp(codec.plname, "red") == 0 ) {
520 channels_[channel]->send_codec = codec;
521 ++num_set_send_codecs_;
524 WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
525 WEBRTC_CHECK_CHANNEL(channel);
526 codec = channels_[channel]->send_codec;
529 WEBRTC_STUB(SetSecondarySendCodec, (int channel,
530 const webrtc::CodecInst& codec,
531 int red_payload_type));
532 WEBRTC_STUB(RemoveSecondarySendCodec, (int channel));
533 WEBRTC_STUB(GetSecondarySendCodec, (int channel,
534 webrtc::CodecInst& codec));
535 WEBRTC_FUNC(GetRecCodec, (int channel, webrtc::CodecInst& codec)) {
536 WEBRTC_CHECK_CHANNEL(channel);
537 const Channel* c = channels_[channel];
538 for (std::list<std::string>::const_iterator it_packet = c->packets.begin();
539 it_packet != c->packets.end(); ++it_packet) {
541 if (!GetRtpPayloadType(it_packet->data(), it_packet->length(), &pltype)) {
544 for (std::vector<webrtc::CodecInst>::const_iterator it_codec =
545 c->recv_codecs.begin(); it_codec != c->recv_codecs.end();
547 if (it_codec->pltype == pltype) {
555 WEBRTC_STUB(SetAMREncFormat, (int channel, webrtc::AmrMode mode));
556 WEBRTC_STUB(SetAMRDecFormat, (int channel, webrtc::AmrMode mode));
557 WEBRTC_STUB(SetAMRWbEncFormat, (int channel, webrtc::AmrMode mode));
558 WEBRTC_STUB(SetAMRWbDecFormat, (int channel, webrtc::AmrMode mode));
559 WEBRTC_STUB(SetISACInitTargetRate, (int channel, int rateBps,
560 bool useFixedFrameSize));
561 WEBRTC_STUB(SetISACMaxRate, (int channel, int rateBps));
562 WEBRTC_STUB(SetISACMaxPayloadSize, (int channel, int sizeBytes));
563 WEBRTC_FUNC(SetRecPayloadType, (int channel,
564 const webrtc::CodecInst& codec)) {
565 WEBRTC_CHECK_CHANNEL(channel);
566 Channel* ch = channels_[channel];
568 return -1; // Channel is in use.
569 // Check if something else already has this slot.
570 if (codec.pltype != -1) {
571 for (std::vector<webrtc::CodecInst>::iterator it =
572 ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
573 if (it->pltype == codec.pltype &&
574 _stricmp(it->plname, codec.plname) != 0) {
579 // Otherwise try to find this codec and update its payload type.
580 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
581 it != ch->recv_codecs.end(); ++it) {
582 if (strcmp(it->plname, codec.plname) == 0 &&
583 it->plfreq == codec.plfreq) {
584 it->pltype = codec.pltype;
585 it->channels = codec.channels;
589 return -1; // not found
591 WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type,
592 webrtc::PayloadFrequencies frequency)) {
593 WEBRTC_CHECK_CHANNEL(channel);
594 if (frequency == webrtc::kFreq8000Hz) {
595 channels_[channel]->cn8_type = type;
596 } else if (frequency == webrtc::kFreq16000Hz) {
597 channels_[channel]->cn16_type = type;
601 WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) {
602 WEBRTC_CHECK_CHANNEL(channel);
603 Channel* ch = channels_[channel];
604 for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
605 it != ch->recv_codecs.end(); ++it) {
606 if (strcmp(it->plname, codec.plname) == 0 &&
607 it->plfreq == codec.plfreq &&
608 it->channels == codec.channels &&
610 codec.pltype = it->pltype;
614 return -1; // not found
616 WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode,
618 WEBRTC_CHECK_CHANNEL(channel);
619 if (channels_[channel]->send_codec.channels == 2) {
620 // Replicating VoE behavior; VAD cannot be enabled for stereo.
623 channels_[channel]->vad = enable;
626 WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
627 webrtc::VadModes& mode, bool& disabledDTX));
628 #ifdef USE_WEBRTC_DEV_BRANCH
629 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
630 WEBRTC_CHECK_CHANNEL(channel);
631 if (strcmp(channels_[channel]->send_codec.plname, "opus")) {
632 // Return -1 if current send codec is not Opus.
633 // TODO(minyue): Excludes other codecs if they support inband FEC.
636 channels_[channel]->codec_fec = enable;
639 WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) {
640 WEBRTC_CHECK_CHANNEL(channel);
641 enable = channels_[channel]->codec_fec;
644 #endif // USE_WEBRTC_DEV_BRANCH
647 WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
648 bool out_of_band = true, int length_ms = 160, int attenuation_db = 10)) {
649 channels_[channel]->dtmf_info.dtmf_event_code = event_code;
650 channels_[channel]->dtmf_info.dtmf_out_of_band = out_of_band;
651 channels_[channel]->dtmf_info.dtmf_length_ms = length_ms;
655 WEBRTC_FUNC(SetSendTelephoneEventPayloadType,
656 (int channel, unsigned char type)) {
657 channels_[channel]->dtmf_type = type;
660 WEBRTC_STUB(GetSendTelephoneEventPayloadType,
661 (int channel, unsigned char& type));
663 WEBRTC_STUB(SetDtmfFeedbackStatus, (bool enable, bool directFeedback));
664 WEBRTC_STUB(GetDtmfFeedbackStatus, (bool& enabled, bool& directFeedback));
665 WEBRTC_STUB(SetDtmfPlayoutStatus, (int channel, bool enable));
666 WEBRTC_STUB(GetDtmfPlayoutStatus, (int channel, bool& enabled));
668 WEBRTC_FUNC(PlayDtmfTone,
669 (int event_code, int length_ms = 200, int attenuation_db = 10)) {
670 dtmf_info_.dtmf_event_code = event_code;
671 dtmf_info_.dtmf_length_ms = length_ms;
674 WEBRTC_STUB(StartPlayingDtmfTone,
675 (int eventCode, int attenuationDb = 10));
676 WEBRTC_STUB(StopPlayingDtmfTone, ());
679 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, const char* fileNameUTF8,
680 bool loop, webrtc::FileFormats format,
681 float volumeScaling, int startPointMs,
683 WEBRTC_CHECK_CHANNEL(channel);
684 channels_[channel]->file = true;
687 WEBRTC_FUNC(StartPlayingFileLocally, (int channel, webrtc::InStream* stream,
688 webrtc::FileFormats format,
689 float volumeScaling, int startPointMs,
691 WEBRTC_CHECK_CHANNEL(channel);
692 channels_[channel]->file = true;
695 WEBRTC_FUNC(StopPlayingFileLocally, (int channel)) {
696 WEBRTC_CHECK_CHANNEL(channel);
697 channels_[channel]->file = false;
700 WEBRTC_FUNC(IsPlayingFileLocally, (int channel)) {
701 WEBRTC_CHECK_CHANNEL(channel);
702 return (channels_[channel]->file) ? 1 : 0;
704 WEBRTC_STUB(ScaleLocalFilePlayout, (int channel, float scale));
705 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
706 const char* fileNameUTF8,
708 bool mixWithMicrophone,
709 webrtc::FileFormats format,
710 float volumeScaling));
711 WEBRTC_STUB(StartPlayingFileAsMicrophone, (int channel,
712 webrtc::InStream* stream,
713 bool mixWithMicrophone,
714 webrtc::FileFormats format,
715 float volumeScaling));
716 WEBRTC_STUB(StopPlayingFileAsMicrophone, (int channel));
717 WEBRTC_STUB(IsPlayingFileAsMicrophone, (int channel));
718 WEBRTC_STUB(ScaleFileAsMicrophonePlayout, (int channel, float scale));
719 WEBRTC_STUB(StartRecordingPlayout, (int channel, const char* fileNameUTF8,
720 webrtc::CodecInst* compression,
722 WEBRTC_STUB(StartRecordingPlayout, (int channel, webrtc::OutStream* stream,
723 webrtc::CodecInst* compression));
724 WEBRTC_STUB(StopRecordingPlayout, (int channel));
725 WEBRTC_FUNC(StartRecordingMicrophone, (const char* fileNameUTF8,
726 webrtc::CodecInst* compression,
728 if (fail_start_recording_microphone_) {
731 recording_microphone_ = true;
734 WEBRTC_FUNC(StartRecordingMicrophone, (webrtc::OutStream* stream,
735 webrtc::CodecInst* compression)) {
736 if (fail_start_recording_microphone_) {
739 recording_microphone_ = true;
742 WEBRTC_FUNC(StopRecordingMicrophone, ()) {
743 if (!recording_microphone_) {
746 recording_microphone_ = false;
749 WEBRTC_STUB(ConvertPCMToWAV, (const char* fileNameInUTF8,
750 const char* fileNameOutUTF8));
751 WEBRTC_STUB(ConvertPCMToWAV, (webrtc::InStream* streamIn,
752 webrtc::OutStream* streamOut));
753 WEBRTC_STUB(ConvertWAVToPCM, (const char* fileNameInUTF8,
754 const char* fileNameOutUTF8));
755 WEBRTC_STUB(ConvertWAVToPCM, (webrtc::InStream* streamIn,
756 webrtc::OutStream* streamOut));
757 WEBRTC_STUB(ConvertPCMToCompressed, (const char* fileNameInUTF8,
758 const char* fileNameOutUTF8,
759 webrtc::CodecInst* compression));
760 WEBRTC_STUB(ConvertPCMToCompressed, (webrtc::InStream* streamIn,
761 webrtc::OutStream* streamOut,
762 webrtc::CodecInst* compression));
763 WEBRTC_STUB(ConvertCompressedToPCM, (const char* fileNameInUTF8,
764 const char* fileNameOutUTF8));
765 WEBRTC_STUB(ConvertCompressedToPCM, (webrtc::InStream* streamIn,
766 webrtc::OutStream* streamOut));
767 WEBRTC_STUB(GetFileDuration, (const char* fileNameUTF8, int& durationMs,
768 webrtc::FileFormats format));
769 WEBRTC_STUB(GetPlaybackPosition, (int channel, int& positionMs));
771 // webrtc::VoEHardware
772 WEBRTC_STUB(GetCPULoad, (int&));
773 WEBRTC_FUNC(GetNumOfRecordingDevices, (int& num)) {
774 return GetNumDevices(num);
776 WEBRTC_FUNC(GetNumOfPlayoutDevices, (int& num)) {
777 return GetNumDevices(num);
779 WEBRTC_FUNC(GetRecordingDeviceName, (int i, char* name, char* guid)) {
780 return GetDeviceName(i, name, guid);
782 WEBRTC_FUNC(GetPlayoutDeviceName, (int i, char* name, char* guid)) {
783 return GetDeviceName(i, name, guid);
785 WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel));
786 WEBRTC_STUB(SetPlayoutDevice, (int));
787 WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers));
788 WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&));
789 WEBRTC_STUB(GetPlayoutDeviceStatus, (bool&));
790 WEBRTC_STUB(GetRecordingDeviceStatus, (bool&));
791 WEBRTC_STUB(ResetAudioDevice, ());
792 WEBRTC_STUB(AudioDeviceControl, (unsigned int, unsigned int, unsigned int));
793 WEBRTC_STUB(SetLoudspeakerStatus, (bool enable));
794 WEBRTC_STUB(GetLoudspeakerStatus, (bool& enabled));
795 WEBRTC_FUNC(SetRecordingSampleRate, (unsigned int samples_per_sec)) {
796 recording_sample_rate_ = samples_per_sec;
799 WEBRTC_FUNC_CONST(RecordingSampleRate, (unsigned int* samples_per_sec)) {
800 *samples_per_sec = recording_sample_rate_;
803 WEBRTC_FUNC(SetPlayoutSampleRate, (unsigned int samples_per_sec)) {
804 playout_sample_rate_ = samples_per_sec;
807 WEBRTC_FUNC_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec)) {
808 *samples_per_sec = playout_sample_rate_;
811 WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
812 virtual bool BuiltInAECIsEnabled() const { return true; }
814 // webrtc::VoENetEqStats
815 WEBRTC_STUB(GetNetworkStatistics, (int, webrtc::NetworkStatistics&));
816 WEBRTC_FUNC_CONST(GetDecodingCallStatistics, (int channel,
817 webrtc::AudioDecodingCallStats*)) {
818 WEBRTC_CHECK_CHANNEL(channel);
822 // webrtc::VoENetwork
823 WEBRTC_FUNC(RegisterExternalTransport, (int channel,
824 webrtc::Transport& transport)) {
825 WEBRTC_CHECK_CHANNEL(channel);
826 channels_[channel]->external_transport = true;
829 WEBRTC_FUNC(DeRegisterExternalTransport, (int channel)) {
830 WEBRTC_CHECK_CHANNEL(channel);
831 channels_[channel]->external_transport = false;
834 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
835 unsigned int length)) {
836 WEBRTC_CHECK_CHANNEL(channel);
837 if (!channels_[channel]->external_transport) return -1;
838 channels_[channel]->packets.push_back(
839 std::string(static_cast<const char*>(data), length));
842 WEBRTC_FUNC(ReceivedRTPPacket, (int channel, const void* data,
844 const webrtc::PacketTime& packet_time)) {
845 WEBRTC_CHECK_CHANNEL(channel);
846 if (ReceivedRTPPacket(channel, data, length) == -1) {
849 channels_[channel]->last_rtp_packet_time = packet_time;
853 WEBRTC_STUB(ReceivedRTCPPacket, (int channel, const void* data,
854 unsigned int length));
856 // webrtc::VoERTP_RTCP
857 WEBRTC_STUB(RegisterRTPObserver, (int channel,
858 webrtc::VoERTPObserver& observer));
859 WEBRTC_STUB(DeRegisterRTPObserver, (int channel));
860 WEBRTC_STUB(RegisterRTCPObserver, (int channel,
861 webrtc::VoERTCPObserver& observer));
862 WEBRTC_STUB(DeRegisterRTCPObserver, (int channel));
863 WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
864 WEBRTC_CHECK_CHANNEL(channel);
865 channels_[channel]->send_ssrc = ssrc;
868 WEBRTC_FUNC(GetLocalSSRC, (int channel, unsigned int& ssrc)) {
869 WEBRTC_CHECK_CHANNEL(channel);
870 ssrc = channels_[channel]->send_ssrc;
873 WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
874 WEBRTC_FUNC(SetSendAudioLevelIndicationStatus, (int channel, bool enable,
876 WEBRTC_CHECK_CHANNEL(channel);
877 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
878 channels_[channel]->send_audio_level_ext_ = (enable) ? id : -1;
881 WEBRTC_FUNC(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable,
883 WEBRTC_CHECK_CHANNEL(channel);
884 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
885 channels_[channel]->receive_audio_level_ext_ = (enable) ? id : -1;
888 WEBRTC_FUNC(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable,
890 WEBRTC_CHECK_CHANNEL(channel);
891 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
892 channels_[channel]->send_absolute_sender_time_ext_ = (enable) ? id : -1;
895 WEBRTC_FUNC(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable,
897 WEBRTC_CHECK_CHANNEL(channel);
898 WEBRTC_CHECK_HEADER_EXTENSION_ID(enable, id);
899 channels_[channel]->receive_absolute_sender_time_ext_ = (enable) ? id : -1;
903 WEBRTC_STUB(GetRemoteCSRCs, (int channel, unsigned int arrCSRC[15]));
904 WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable));
905 WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
906 WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
907 WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
908 WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
909 WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
910 unsigned int& NTPLow,
911 unsigned int& timestamp,
912 unsigned int& playoutTimestamp,
913 unsigned int* jitter,
914 unsigned short* fractionLost));
915 WEBRTC_STUB(GetRemoteRTCPSenderInfo, (int channel,
916 webrtc::SenderInfo* sender_info));
917 WEBRTC_FUNC(GetRemoteRTCPReportBlocks,
918 (int channel, std::vector<webrtc::ReportBlock>* receive_blocks)) {
919 WEBRTC_CHECK_CHANNEL(channel);
920 webrtc::ReportBlock block;
921 block.source_SSRC = channels_[channel]->send_ssrc;
922 webrtc::CodecInst send_codec = channels_[channel]->send_codec;
923 if (send_codec.pltype >= 0) {
924 block.fraction_lost = (unsigned char)(kFractionLostStatValue * 256);
925 if (send_codec.plfreq / 1000 > 0) {
926 block.interarrival_jitter = kIntStatValue * (send_codec.plfreq / 1000);
928 block.cumulative_num_packets_lost = kIntStatValue;
929 block.extended_highest_sequence_number = kIntStatValue;
930 receive_blocks->push_back(block);
934 WEBRTC_STUB(SendApplicationDefinedRTCPPacket, (int channel,
935 unsigned char subType,
938 unsigned short dataLength));
939 WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
940 unsigned int& maxJitterMs,
941 unsigned int& discardedPackets));
942 WEBRTC_FUNC(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats)) {
943 WEBRTC_CHECK_CHANNEL(channel);
944 stats.fractionLost = static_cast<int16>(kIntStatValue);
945 stats.cumulativeLost = kIntStatValue;
946 stats.extendedMax = kIntStatValue;
947 stats.jitterSamples = kIntStatValue;
948 stats.rttMs = kIntStatValue;
949 stats.bytesSent = kIntStatValue;
950 stats.packetsSent = kIntStatValue;
951 stats.bytesReceived = kIntStatValue;
952 stats.packetsReceived = kIntStatValue;
955 #ifdef USE_WEBRTC_DEV_BRANCH
956 WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
957 return SetFECStatus(channel, enable, redPayloadtype);
960 // TODO(minyue): remove the below function when transition to SetREDStatus
962 WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
963 WEBRTC_CHECK_CHANNEL(channel);
964 channels_[channel]->red = enable;
965 channels_[channel]->red_type = redPayloadtype;
968 #ifdef USE_WEBRTC_DEV_BRANCH
969 WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) {
970 return GetFECStatus(channel, enable, redPayloadtype);
973 // TODO(minyue): remove the below function when transition to GetREDStatus
975 WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
976 WEBRTC_CHECK_CHANNEL(channel);
977 enable = channels_[channel]->red;
978 redPayloadtype = channels_[channel]->red_type;
981 WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
982 WEBRTC_CHECK_CHANNEL(channel);
983 channels_[channel]->nack = enable;
984 channels_[channel]->nack_max_packets = maxNoPackets;
987 WEBRTC_STUB(StartRTPDump, (int channel, const char* fileNameUTF8,
988 webrtc::RTPDirections direction));
989 WEBRTC_STUB(StopRTPDump, (int channel, webrtc::RTPDirections direction));
990 WEBRTC_STUB(RTPDumpIsActive, (int channel, webrtc::RTPDirections direction));
991 WEBRTC_STUB(InsertExtraRTPPacket, (int channel, unsigned char payloadType,
992 bool markerBit, const char* payloadData,
993 unsigned short payloadSize));
994 WEBRTC_STUB(GetLastRemoteTimeStamp, (int channel,
995 uint32_t* lastRemoteTimeStamp));
996 WEBRTC_FUNC(SetVideoEngineBWETarget, (int channel,
997 webrtc::ViENetwork* vie_network,
998 int video_channel)) {
999 WEBRTC_CHECK_CHANNEL(channel);
1000 channels_[channel]->vie_network = vie_network;
1001 channels_[channel]->video_channel = video_channel;
1005 // webrtc::VoEVideoSync
1006 WEBRTC_STUB(GetPlayoutBufferSize, (int& bufferMs));
1007 WEBRTC_STUB(GetPlayoutTimestamp, (int channel, unsigned int& timestamp));
1008 WEBRTC_STUB(GetRtpRtcp, (int, webrtc::RtpRtcp**, webrtc::RtpReceiver**));
1009 WEBRTC_STUB(SetInitTimestamp, (int channel, unsigned int timestamp));
1010 WEBRTC_STUB(SetInitSequenceNumber, (int channel, short sequenceNumber));
1011 WEBRTC_STUB(SetMinimumPlayoutDelay, (int channel, int delayMs));
1012 WEBRTC_STUB(SetInitialPlayoutDelay, (int channel, int delay_ms));
1013 WEBRTC_STUB(GetDelayEstimate, (int channel, int* jitter_buffer_delay_ms,
1014 int* playout_buffer_delay_ms));
1015 WEBRTC_STUB_CONST(GetLeastRequiredDelayMs, (int channel));
1017 // webrtc::VoEVolumeControl
1018 WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
1019 WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
1020 WEBRTC_STUB(SetSystemOutputMute, (bool));
1021 WEBRTC_STUB(GetSystemOutputMute, (bool&));
1022 WEBRTC_STUB(SetMicVolume, (unsigned int));
1023 WEBRTC_STUB(GetMicVolume, (unsigned int&));
1024 WEBRTC_STUB(SetInputMute, (int, bool));
1025 WEBRTC_STUB(GetInputMute, (int, bool&));
1026 WEBRTC_STUB(SetSystemInputMute, (bool));
1027 WEBRTC_STUB(GetSystemInputMute, (bool&));
1028 WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
1029 WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
1030 WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
1031 WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&));
1032 WEBRTC_FUNC(SetChannelOutputVolumeScaling, (int channel, float scale)) {
1033 WEBRTC_CHECK_CHANNEL(channel);
1034 channels_[channel]->volume_scale= scale;
1037 WEBRTC_FUNC(GetChannelOutputVolumeScaling, (int channel, float& scale)) {
1038 WEBRTC_CHECK_CHANNEL(channel);
1039 scale = channels_[channel]->volume_scale;
1042 WEBRTC_FUNC(SetOutputVolumePan, (int channel, float left, float right)) {
1043 WEBRTC_CHECK_CHANNEL(channel);
1044 channels_[channel]->volume_pan_left = left;
1045 channels_[channel]->volume_pan_right = right;
1048 WEBRTC_FUNC(GetOutputVolumePan, (int channel, float& left, float& right)) {
1049 WEBRTC_CHECK_CHANNEL(channel);
1050 left = channels_[channel]->volume_pan_left;
1051 right = channels_[channel]->volume_pan_right;
1055 // webrtc::VoEAudioProcessing
1056 WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) {
1057 ns_enabled_ = enable;
1061 WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) {
1062 enabled = ns_enabled_;
1067 WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
1068 agc_enabled_ = enable;
1072 WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) {
1073 enabled = agc_enabled_;
1078 WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
1079 agc_config_ = config;
1082 WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) {
1083 config = agc_config_;
1086 WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) {
1087 ec_enabled_ = enable;
1091 WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) {
1092 enabled = ec_enabled_;
1096 WEBRTC_STUB(EnableDriftCompensation, (bool enable))
1097 WEBRTC_BOOL_STUB(DriftCompensationEnabled, ())
1098 WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset))
1099 WEBRTC_STUB(DelayOffsetMs, ());
1100 WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) {
1102 cng_enabled_ = enableCNG;
1105 WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) {
1107 enabledCNG = cng_enabled_;
1110 WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode));
1111 WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled,
1112 webrtc::NsModes& mode));
1113 WEBRTC_FUNC(SetRxAgcStatus, (int channel, bool enable,
1114 webrtc::AgcModes mode)) {
1115 channels_[channel]->rx_agc_enabled = enable;
1116 channels_[channel]->rx_agc_mode = mode;
1119 WEBRTC_FUNC(GetRxAgcStatus, (int channel, bool& enabled,
1120 webrtc::AgcModes& mode)) {
1121 enabled = channels_[channel]->rx_agc_enabled;
1122 mode = channels_[channel]->rx_agc_mode;
1126 WEBRTC_FUNC(SetRxAgcConfig, (int channel, webrtc::AgcConfig config)) {
1127 channels_[channel]->rx_agc_config = config;
1130 WEBRTC_FUNC(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config)) {
1131 config = channels_[channel]->rx_agc_config;
1135 WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
1136 WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
1137 WEBRTC_STUB(VoiceActivityIndicator, (int channel));
1138 WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) {
1139 ec_metrics_enabled_ = enable;
1142 WEBRTC_FUNC(GetEcMetricsStatus, (bool& enabled)) {
1143 enabled = ec_metrics_enabled_;
1146 WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
1147 WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std));
1149 WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
1150 WEBRTC_STUB(StartDebugRecording, (FILE* handle));
1151 WEBRTC_STUB(StopDebugRecording, ());
1153 WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
1154 typing_detection_enabled_ = enable;
1157 WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) {
1158 enabled = typing_detection_enabled_;
1162 WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
1163 WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
1165 int reportingThreshold,
1167 int typeEventDelay));
1168 int EnableHighPassFilter(bool enable) {
1169 highpass_filter_enabled_ = enable;
1172 bool IsHighPassFilterEnabled() {
1173 return highpass_filter_enabled_;
1175 bool IsStereoChannelSwappingEnabled() {
1176 return stereo_swapping_enabled_;
1178 void EnableStereoChannelSwapping(bool enable) {
1179 stereo_swapping_enabled_ = enable;
1181 bool WasSendTelephoneEventCalled(int channel, int event_code, int length_ms) {
1182 return (channels_[channel]->dtmf_info.dtmf_event_code == event_code &&
1183 channels_[channel]->dtmf_info.dtmf_out_of_band == true &&
1184 channels_[channel]->dtmf_info.dtmf_length_ms == length_ms);
1186 bool WasPlayDtmfToneCalled(int event_code, int length_ms) {
1187 return (dtmf_info_.dtmf_event_code == event_code &&
1188 dtmf_info_.dtmf_length_ms == length_ms);
1190 // webrtc::VoEExternalMedia
1191 WEBRTC_FUNC(RegisterExternalMediaProcessing,
1192 (int channel, webrtc::ProcessingTypes type,
1193 webrtc::VoEMediaProcess& processObject)) {
1194 WEBRTC_CHECK_CHANNEL(channel);
1195 if (channels_[channel]->media_processor_registered) {
1198 channels_[channel]->media_processor_registered = true;
1199 media_processor_ = &processObject;
1202 WEBRTC_FUNC(DeRegisterExternalMediaProcessing,
1203 (int channel, webrtc::ProcessingTypes type)) {
1204 WEBRTC_CHECK_CHANNEL(channel);
1205 if (!channels_[channel]->media_processor_registered) {
1208 channels_[channel]->media_processor_registered = false;
1209 media_processor_ = NULL;
1212 WEBRTC_STUB(SetExternalRecordingStatus, (bool enable));
1213 WEBRTC_STUB(SetExternalPlayoutStatus, (bool enable));
1214 WEBRTC_STUB(ExternalRecordingInsertData,
1215 (const int16_t speechData10ms[], int lengthSamples,
1216 int samplingFreqHz, int current_delay_ms));
1217 WEBRTC_STUB(ExternalPlayoutGetData,
1218 (int16_t speechData10ms[], int samplingFreqHz,
1219 int current_delay_ms, int& lengthSamples));
1220 WEBRTC_STUB(GetAudioFrame, (int channel, int desired_sample_rate_hz,
1221 webrtc::AudioFrame* frame));
1222 WEBRTC_STUB(SetExternalMixing, (int channel, bool enable));
1225 int GetNumDevices(int& num) {
1229 // On non-Windows platforms VE adds a special entry for the default device,
1230 // so if there is one physical device then there are two entries in the
1237 int GetDeviceName(int i, char* name, char* guid) {
1241 s = kFakeDeviceName;
1246 // See comment above.
1248 s = kFakeDefaultDeviceName;
1249 } else if (1 == i) {
1250 s = kFakeDeviceName;
1262 std::map<int, Channel*> channels_;
1263 bool fail_create_channel_;
1264 const cricket::AudioCodec* const* codecs_;
1266 int num_set_send_codecs_; // how many times we call SetSendCodec().
1268 bool ec_metrics_enabled_;
1272 bool highpass_filter_enabled_;
1273 bool stereo_swapping_enabled_;
1274 bool typing_detection_enabled_;
1275 webrtc::EcModes ec_mode_;
1276 webrtc::AecmModes aecm_mode_;
1277 webrtc::NsModes ns_mode_;
1278 webrtc::AgcModes agc_mode_;
1279 webrtc::AgcConfig agc_config_;
1280 webrtc::VoiceEngineObserver* observer_;
1281 int playout_fail_channel_;
1282 int send_fail_channel_;
1283 bool fail_start_recording_microphone_;
1284 bool recording_microphone_;
1285 int recording_sample_rate_;
1286 int playout_sample_rate_;
1287 DtmfInfo dtmf_info_;
1288 webrtc::VoEMediaProcess* media_processor_;
1289 #ifdef USE_WEBRTC_DEV_BRANCH
1290 FakeAudioProcessing audio_processing_;
1294 #undef WEBRTC_CHECK_HEADER_EXTENSION_ID
1296 } // namespace cricket
1298 #endif // TALK_SESSION_PHONE_FAKEWEBRTCVOICEENGINE_H_