2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Copyright (c) 2010 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
|
|
|
|
|
#define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/base/basictypes.h"
|
2015-05-07 17:07:34 +02:00
|
|
|
#include "webrtc/base/checks.h"
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/base/gunit.h"
|
|
|
|
|
#include "webrtc/base/stringutils.h"
|
2015-05-11 12:44:23 +02:00
|
|
|
#include "webrtc/config.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/media/base/codec.h"
|
|
|
|
|
#include "webrtc/media/base/rtputils.h"
|
2016-02-12 06:39:40 +01:00
|
|
|
#include "webrtc/media/engine/fakewebrtccommon.h"
|
|
|
|
|
#include "webrtc/media/engine/webrtcvoe.h"
|
2015-11-27 04:00:25 -08:00
|
|
|
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
|
2014-07-16 14:23:08 +00:00
|
|
|
#include "webrtc/modules/audio_processing/include/audio_processing.h"
|
2014-04-14 16:06:21 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
namespace cricket {
|
|
|
|
|
|
2014-09-10 07:57:12 +00:00
|
|
|
static const int kOpusBandwidthNb = 4000;
|
|
|
|
|
static const int kOpusBandwidthMb = 6000;
|
|
|
|
|
static const int kOpusBandwidthWb = 8000;
|
|
|
|
|
static const int kOpusBandwidthSwb = 12000;
|
|
|
|
|
static const int kOpusBandwidthFb = 20000;
|
|
|
|
|
|
2015-05-07 17:07:34 +02:00
|
|
|
#define WEBRTC_CHECK_CHANNEL(channel) \
|
|
|
|
|
if (channels_.find(channel) == channels_.end()) return -1;
|
|
|
|
|
|
2014-07-16 14:23:08 +00:00
|
|
|
class FakeAudioProcessing : public webrtc::AudioProcessing {
|
|
|
|
|
public:
|
|
|
|
|
FakeAudioProcessing() : experimental_ns_enabled_(false) {}
|
|
|
|
|
|
|
|
|
|
WEBRTC_STUB(Initialize, ())
|
|
|
|
|
WEBRTC_STUB(Initialize, (
|
|
|
|
|
int input_sample_rate_hz,
|
|
|
|
|
int output_sample_rate_hz,
|
|
|
|
|
int reverse_sample_rate_hz,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout input_layout,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout output_layout,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout reverse_layout));
|
2015-07-23 11:41:39 -07:00
|
|
|
WEBRTC_STUB(Initialize, (
|
|
|
|
|
const webrtc::ProcessingConfig& processing_config));
|
2014-07-16 14:23:08 +00:00
|
|
|
|
|
|
|
|
WEBRTC_VOID_FUNC(SetExtraOptions, (const webrtc::Config& config)) {
|
|
|
|
|
experimental_ns_enabled_ = config.Get<webrtc::ExperimentalNs>().enabled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WEBRTC_STUB_CONST(proc_sample_rate_hz, ());
|
|
|
|
|
WEBRTC_STUB_CONST(proc_split_sample_rate_hz, ());
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
size_t num_input_channels() const override { return 0; }
|
|
|
|
|
size_t num_proc_channels() const override { return 0; }
|
|
|
|
|
size_t num_output_channels() const override { return 0; }
|
|
|
|
|
size_t num_reverse_channels() const override { return 0; }
|
2014-07-16 14:23:08 +00:00
|
|
|
WEBRTC_VOID_STUB(set_output_will_be_muted, (bool muted));
|
|
|
|
|
WEBRTC_STUB(ProcessStream, (webrtc::AudioFrame* frame));
|
|
|
|
|
WEBRTC_STUB(ProcessStream, (
|
|
|
|
|
const float* const* src,
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
size_t samples_per_channel,
|
2014-07-16 14:23:08 +00:00
|
|
|
int input_sample_rate_hz,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout input_layout,
|
|
|
|
|
int output_sample_rate_hz,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout output_layout,
|
|
|
|
|
float* const* dest));
|
2015-07-23 11:41:39 -07:00
|
|
|
WEBRTC_STUB(ProcessStream,
|
|
|
|
|
(const float* const* src,
|
|
|
|
|
const webrtc::StreamConfig& input_config,
|
|
|
|
|
const webrtc::StreamConfig& output_config,
|
|
|
|
|
float* const* dest));
|
2015-08-14 10:35:55 -07:00
|
|
|
WEBRTC_STUB(ProcessReverseStream, (webrtc::AudioFrame * frame));
|
2014-07-16 14:23:08 +00:00
|
|
|
WEBRTC_STUB(AnalyzeReverseStream, (
|
|
|
|
|
const float* const* data,
|
Update a ton of audio code to use size_t more correctly and in general reduce
use of int16_t/uint16_t.
This is the upshot of a recommendation by henrik.lundin and kwiberg on an original small change ( https://webrtc-codereview.appspot.com/42569004/#ps1 ) to stop using int16_t just because values could fit in it, and is similar in nature to a previous "mass change to use size_t more" ( https://webrtc-codereview.appspot.com/23129004/ ) which also needed to be split up for review but to land all at once, since, like adding "const", such changes tend to cause a lot of transitive effects.
This was be reviewed and approved in pieces:
https://codereview.webrtc.org/1224093003
https://codereview.webrtc.org/1224123002
https://codereview.webrtc.org/1224163002
https://codereview.webrtc.org/1225133003
https://codereview.webrtc.org/1225173002
https://codereview.webrtc.org/1227163003
https://codereview.webrtc.org/1227203003
https://codereview.webrtc.org/1227213002
https://codereview.webrtc.org/1227893002
https://codereview.webrtc.org/1228793004
https://codereview.webrtc.org/1228803003
https://codereview.webrtc.org/1228823002
https://codereview.webrtc.org/1228823003
https://codereview.webrtc.org/1228843002
https://codereview.webrtc.org/1230693002
https://codereview.webrtc.org/1231713002
The change is being landed as TBR to all the folks who reviewed the above.
BUG=chromium:81439
TEST=none
R=andrew@webrtc.org, pbos@webrtc.org
TBR=aluebs, andrew, asapersson, henrika, hlundin, jan.skoglund, kwiberg, minyue, pbos, pthatcher
Review URL: https://codereview.webrtc.org/1230503003 .
Cr-Commit-Position: refs/heads/master@{#9768}
2015-08-24 14:52:23 -07:00
|
|
|
size_t samples_per_channel,
|
2014-07-16 14:23:08 +00:00
|
|
|
int sample_rate_hz,
|
|
|
|
|
webrtc::AudioProcessing::ChannelLayout layout));
|
2015-08-14 10:35:55 -07:00
|
|
|
WEBRTC_STUB(ProcessReverseStream,
|
|
|
|
|
(const float* const* src,
|
|
|
|
|
const webrtc::StreamConfig& reverse_input_config,
|
|
|
|
|
const webrtc::StreamConfig& reverse_output_config,
|
|
|
|
|
float* const* dest));
|
2014-07-16 14:23:08 +00:00
|
|
|
WEBRTC_STUB(set_stream_delay_ms, (int delay));
|
|
|
|
|
WEBRTC_STUB_CONST(stream_delay_ms, ());
|
|
|
|
|
WEBRTC_BOOL_STUB_CONST(was_stream_delay_set, ());
|
|
|
|
|
WEBRTC_VOID_STUB(set_stream_key_pressed, (bool key_pressed));
|
|
|
|
|
WEBRTC_VOID_STUB(set_delay_offset_ms, (int offset));
|
|
|
|
|
WEBRTC_STUB_CONST(delay_offset_ms, ());
|
2016-01-15 03:06:36 -08:00
|
|
|
WEBRTC_STUB(StartDebugRecording,
|
|
|
|
|
(const char filename[kMaxFilenameSize], int64_t max_size_bytes));
|
|
|
|
|
WEBRTC_STUB(StartDebugRecording, (FILE * handle, int64_t max_size_bytes));
|
2014-07-16 14:23:08 +00:00
|
|
|
WEBRTC_STUB(StopDebugRecording, ());
|
2015-07-07 11:50:05 +02:00
|
|
|
WEBRTC_VOID_STUB(UpdateHistogramsOnCallEnd, ());
|
2015-03-04 12:58:35 +00:00
|
|
|
webrtc::EchoCancellation* echo_cancellation() const override { return NULL; }
|
|
|
|
|
webrtc::EchoControlMobile* echo_control_mobile() const override {
|
2014-07-16 14:23:08 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-03-04 12:58:35 +00:00
|
|
|
webrtc::GainControl* gain_control() const override { return NULL; }
|
|
|
|
|
webrtc::HighPassFilter* high_pass_filter() const override { return NULL; }
|
|
|
|
|
webrtc::LevelEstimator* level_estimator() const override { return NULL; }
|
|
|
|
|
webrtc::NoiseSuppression* noise_suppression() const override { return NULL; }
|
|
|
|
|
webrtc::VoiceDetection* voice_detection() const override { return NULL; }
|
2014-07-16 14:23:08 +00:00
|
|
|
|
|
|
|
|
bool experimental_ns_enabled() {
|
|
|
|
|
return experimental_ns_enabled_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool experimental_ns_enabled_;
|
|
|
|
|
};
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
class FakeWebRtcVoiceEngine
|
|
|
|
|
: public webrtc::VoEAudioProcessing,
|
2015-12-04 15:22:19 +01:00
|
|
|
public webrtc::VoEBase, public webrtc::VoECodec,
|
2016-04-29 09:05:28 -07:00
|
|
|
public webrtc::VoEHardware, public webrtc::VoERTP_RTCP,
|
2015-10-22 10:49:27 +02:00
|
|
|
public webrtc::VoEVolumeControl {
|
2013-07-10 00:45:36 +00:00
|
|
|
public:
|
|
|
|
|
struct Channel {
|
2016-04-04 09:54:44 -07:00
|
|
|
Channel() {
|
2013-07-10 00:45:36 +00:00
|
|
|
memset(&send_codec, 0, sizeof(send_codec));
|
|
|
|
|
}
|
2016-04-04 09:54:44 -07:00
|
|
|
bool playout = false;
|
|
|
|
|
float volume_scale = 1.0f;
|
|
|
|
|
bool vad = false;
|
|
|
|
|
bool codec_fec = false;
|
|
|
|
|
int max_encoding_bandwidth = 0;
|
|
|
|
|
bool opus_dtx = false;
|
|
|
|
|
bool red = false;
|
|
|
|
|
bool nack = false;
|
|
|
|
|
int cn8_type = 13;
|
|
|
|
|
int cn16_type = 105;
|
|
|
|
|
int red_type = 117;
|
|
|
|
|
int nack_max_packets = 0;
|
|
|
|
|
uint32_t send_ssrc = 0;
|
|
|
|
|
int associate_send_channel = -1;
|
2013-07-10 00:45:36 +00:00
|
|
|
std::vector<webrtc::CodecInst> recv_codecs;
|
|
|
|
|
webrtc::CodecInst send_codec;
|
2016-04-04 09:54:44 -07:00
|
|
|
int neteq_capacity = -1;
|
|
|
|
|
bool neteq_fast_accelerate = false;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
2016-04-04 09:54:44 -07:00
|
|
|
FakeWebRtcVoiceEngine() {
|
2013-07-10 00:45:36 +00:00
|
|
|
memset(&agc_config_, 0, sizeof(agc_config_));
|
|
|
|
|
}
|
2016-03-30 23:28:51 -07:00
|
|
|
~FakeWebRtcVoiceEngine() override {
|
2015-11-27 04:00:25 -08:00
|
|
|
RTC_CHECK(channels_.empty());
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-27 03:35:21 -07:00
|
|
|
bool ec_metrics_enabled() const { return ec_metrics_enabled_; }
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
bool IsInited() const { return inited_; }
|
|
|
|
|
int GetLastChannel() const { return last_channel_; }
|
2013-12-11 18:25:07 +00:00
|
|
|
int GetNumChannels() const { return static_cast<int>(channels_.size()); }
|
2015-10-27 03:35:21 -07:00
|
|
|
uint32_t GetLocalSSRC(int channel) {
|
|
|
|
|
return channels_[channel]->send_ssrc;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
bool GetPlayout(int channel) {
|
|
|
|
|
return channels_[channel]->playout;
|
|
|
|
|
}
|
|
|
|
|
bool GetVAD(int channel) {
|
|
|
|
|
return channels_[channel]->vad;
|
|
|
|
|
}
|
2015-03-27 05:05:59 +01:00
|
|
|
bool GetOpusDtx(int channel) {
|
|
|
|
|
return channels_[channel]->opus_dtx;
|
|
|
|
|
}
|
2014-06-17 10:56:41 +00:00
|
|
|
bool GetRED(int channel) {
|
|
|
|
|
return channels_[channel]->red;
|
|
|
|
|
}
|
|
|
|
|
bool GetCodecFEC(int channel) {
|
|
|
|
|
return channels_[channel]->codec_fec;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
2014-09-10 07:57:12 +00:00
|
|
|
int GetMaxEncodingBandwidth(int channel) {
|
|
|
|
|
return channels_[channel]->max_encoding_bandwidth;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
bool GetNACK(int channel) {
|
|
|
|
|
return channels_[channel]->nack;
|
|
|
|
|
}
|
|
|
|
|
int GetNACKMaxPackets(int channel) {
|
|
|
|
|
return channels_[channel]->nack_max_packets;
|
|
|
|
|
}
|
|
|
|
|
int GetSendCNPayloadType(int channel, bool wideband) {
|
|
|
|
|
return (wideband) ?
|
|
|
|
|
channels_[channel]->cn16_type :
|
|
|
|
|
channels_[channel]->cn8_type;
|
|
|
|
|
}
|
2014-06-17 10:56:41 +00:00
|
|
|
int GetSendREDPayloadType(int channel) {
|
|
|
|
|
return channels_[channel]->red_type;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
void set_playout_fail_channel(int channel) {
|
|
|
|
|
playout_fail_channel_ = channel;
|
|
|
|
|
}
|
|
|
|
|
void set_fail_create_channel(bool fail_create_channel) {
|
|
|
|
|
fail_create_channel_ = fail_create_channel;
|
|
|
|
|
}
|
2015-05-11 12:44:23 +02:00
|
|
|
int AddChannel(const webrtc::Config& config) {
|
2013-11-20 21:49:41 +00:00
|
|
|
if (fail_create_channel_) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2014-04-28 21:31:51 +00:00
|
|
|
Channel* ch = new Channel();
|
2015-11-27 04:00:25 -08:00
|
|
|
auto db = webrtc::acm2::RentACodec::Database();
|
|
|
|
|
ch->recv_codecs.assign(db.begin(), db.end());
|
2015-05-11 12:44:23 +02:00
|
|
|
if (config.Get<webrtc::NetEqCapacityConfig>().enabled) {
|
|
|
|
|
ch->neteq_capacity = config.Get<webrtc::NetEqCapacityConfig>().capacity;
|
|
|
|
|
}
|
2015-06-01 10:29:41 +02:00
|
|
|
ch->neteq_fast_accelerate =
|
|
|
|
|
config.Get<webrtc::NetEqFastAccelerate>().enabled;
|
2013-11-20 21:49:41 +00:00
|
|
|
channels_[++last_channel_] = ch;
|
|
|
|
|
return last_channel_;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-04-01 17:44:24 +00:00
|
|
|
int GetNumSetSendCodecs() const { return num_set_send_codecs_; }
|
|
|
|
|
|
2015-05-13 14:14:42 +02:00
|
|
|
int GetAssociateSendChannel(int channel) {
|
|
|
|
|
return channels_[channel]->associate_send_channel;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(Release, ());
|
|
|
|
|
|
|
|
|
|
// webrtc::VoEBase
|
2016-04-04 09:54:44 -07:00
|
|
|
WEBRTC_STUB(RegisterVoiceEngineObserver, (
|
|
|
|
|
webrtc::VoiceEngineObserver& observer));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(DeRegisterVoiceEngineObserver, ());
|
|
|
|
|
WEBRTC_FUNC(Init, (webrtc::AudioDeviceModule* adm,
|
|
|
|
|
webrtc::AudioProcessing* audioproc)) {
|
|
|
|
|
inited_ = true;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(Terminate, ()) {
|
|
|
|
|
inited_ = false;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-03-04 12:58:35 +00:00
|
|
|
webrtc::AudioProcessing* audio_processing() override {
|
2014-07-16 14:23:08 +00:00
|
|
|
return &audio_processing_;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
2016-03-30 23:28:51 -07:00
|
|
|
webrtc::AudioDeviceModule* audio_device_module() override {
|
2016-04-04 09:54:44 -07:00
|
|
|
return nullptr;
|
2016-03-30 23:28:51 -07:00
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_FUNC(CreateChannel, ()) {
|
2015-05-11 12:44:23 +02:00
|
|
|
webrtc::Config empty_config;
|
|
|
|
|
return AddChannel(empty_config);
|
2013-11-20 21:49:41 +00:00
|
|
|
}
|
2015-05-11 12:44:23 +02:00
|
|
|
WEBRTC_FUNC(CreateChannel, (const webrtc::Config& config)) {
|
|
|
|
|
return AddChannel(config);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(DeleteChannel, (int channel)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
2015-05-13 14:14:42 +02:00
|
|
|
for (const auto& ch : channels_) {
|
|
|
|
|
if (ch.second->associate_send_channel == channel) {
|
|
|
|
|
ch.second->associate_send_channel = -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
delete channels_[channel];
|
|
|
|
|
channels_.erase(channel);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_STUB(StartReceive, (int channel));
|
|
|
|
|
WEBRTC_FUNC(StartPlayout, (int channel)) {
|
|
|
|
|
if (playout_fail_channel_ != channel) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->playout = true;
|
|
|
|
|
return 0;
|
|
|
|
|
} else {
|
|
|
|
|
// When playout_fail_channel_ == channel, fail the StartPlayout on this
|
|
|
|
|
// channel.
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-08 12:37:39 -08:00
|
|
|
WEBRTC_STUB(StartSend, (int channel));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(StopReceive, (int channel));
|
|
|
|
|
WEBRTC_FUNC(StopPlayout, (int channel)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->playout = false;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-03-08 12:37:39 -08:00
|
|
|
WEBRTC_STUB(StopSend, (int channel));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(GetVersion, (char version[1024]));
|
|
|
|
|
WEBRTC_STUB(LastError, ());
|
2015-05-13 14:14:42 +02:00
|
|
|
WEBRTC_FUNC(AssociateSendChannel, (int channel,
|
|
|
|
|
int accociate_send_channel)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->associate_send_channel = accociate_send_channel;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-04-29 06:09:15 -07:00
|
|
|
webrtc::RtcEventLog* GetEventLog() override { return nullptr; }
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// webrtc::VoECodec
|
2015-11-27 04:00:25 -08:00
|
|
|
WEBRTC_STUB(NumOfCodecs, ());
|
|
|
|
|
WEBRTC_STUB(GetCodec, (int index, webrtc::CodecInst& codec));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_FUNC(SetSendCodec, (int channel, const webrtc::CodecInst& codec)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
2014-02-27 17:52:04 +00:00
|
|
|
// To match the behavior of the real implementation.
|
|
|
|
|
if (_stricmp(codec.plname, "telephone-event") == 0 ||
|
|
|
|
|
_stricmp(codec.plname, "audio/telephone-event") == 0 ||
|
|
|
|
|
_stricmp(codec.plname, "CN") == 0 ||
|
|
|
|
|
_stricmp(codec.plname, "red") == 0 ) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
channels_[channel]->send_codec = codec;
|
2014-04-01 17:44:24 +00:00
|
|
|
++num_set_send_codecs_;
|
2013-07-10 00:45:36 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetSendCodec, (int channel, webrtc::CodecInst& codec)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
codec = channels_[channel]->send_codec;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-04-29 16:03:33 +02:00
|
|
|
WEBRTC_STUB(SetBitRate, (int channel, int bitrate_bps));
|
2015-10-22 10:49:27 +02:00
|
|
|
WEBRTC_STUB(GetRecCodec, (int channel, webrtc::CodecInst& codec));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_FUNC(SetRecPayloadType, (int channel,
|
|
|
|
|
const webrtc::CodecInst& codec)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
Channel* ch = channels_[channel];
|
|
|
|
|
if (ch->playout)
|
|
|
|
|
return -1; // Channel is in use.
|
|
|
|
|
// Check if something else already has this slot.
|
|
|
|
|
if (codec.pltype != -1) {
|
|
|
|
|
for (std::vector<webrtc::CodecInst>::iterator it =
|
|
|
|
|
ch->recv_codecs.begin(); it != ch->recv_codecs.end(); ++it) {
|
|
|
|
|
if (it->pltype == codec.pltype &&
|
|
|
|
|
_stricmp(it->plname, codec.plname) != 0) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Otherwise try to find this codec and update its payload type.
|
2015-11-27 04:00:25 -08:00
|
|
|
int result = -1; // not found
|
2013-07-10 00:45:36 +00:00
|
|
|
for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
|
|
|
|
|
it != ch->recv_codecs.end(); ++it) {
|
|
|
|
|
if (strcmp(it->plname, codec.plname) == 0 &&
|
2015-11-27 04:00:25 -08:00
|
|
|
it->plfreq == codec.plfreq &&
|
|
|
|
|
it->channels == codec.channels) {
|
2013-07-10 00:45:36 +00:00
|
|
|
it->pltype = codec.pltype;
|
2015-11-27 04:00:25 -08:00
|
|
|
result = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-27 04:00:25 -08:00
|
|
|
return result;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(SetSendCNPayloadType, (int channel, int type,
|
|
|
|
|
webrtc::PayloadFrequencies frequency)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
if (frequency == webrtc::kFreq8000Hz) {
|
|
|
|
|
channels_[channel]->cn8_type = type;
|
|
|
|
|
} else if (frequency == webrtc::kFreq16000Hz) {
|
|
|
|
|
channels_[channel]->cn16_type = type;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetRecPayloadType, (int channel, webrtc::CodecInst& codec)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
Channel* ch = channels_[channel];
|
|
|
|
|
for (std::vector<webrtc::CodecInst>::iterator it = ch->recv_codecs.begin();
|
|
|
|
|
it != ch->recv_codecs.end(); ++it) {
|
|
|
|
|
if (strcmp(it->plname, codec.plname) == 0 &&
|
|
|
|
|
it->plfreq == codec.plfreq &&
|
|
|
|
|
it->channels == codec.channels &&
|
|
|
|
|
it->pltype != -1) {
|
|
|
|
|
codec.pltype = it->pltype;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return -1; // not found
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(SetVADStatus, (int channel, bool enable, webrtc::VadModes mode,
|
|
|
|
|
bool disableDTX)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
if (channels_[channel]->send_codec.channels == 2) {
|
|
|
|
|
// Replicating VoE behavior; VAD cannot be enabled for stereo.
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
channels_[channel]->vad = enable;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
|
|
|
|
|
webrtc::VadModes& mode, bool& disabledDTX));
|
2014-09-10 07:57:12 +00:00
|
|
|
|
2014-06-17 10:56:41 +00:00
|
|
|
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
2014-09-10 07:57:12 +00:00
|
|
|
if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
|
2014-07-02 19:51:26 +00:00
|
|
|
// Return -1 if current send codec is not Opus.
|
|
|
|
|
// TODO(minyue): Excludes other codecs if they support inband FEC.
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2014-06-17 10:56:41 +00:00
|
|
|
channels_[channel]->codec_fec = enable;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
enable = channels_[channel]->codec_fec;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2014-09-10 07:57:12 +00:00
|
|
|
|
|
|
|
|
WEBRTC_FUNC(SetOpusMaxPlaybackRate, (int channel, int frequency_hz)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
|
|
|
|
|
// Return -1 if current send codec is not Opus.
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (frequency_hz <= 8000)
|
|
|
|
|
channels_[channel]->max_encoding_bandwidth = kOpusBandwidthNb;
|
|
|
|
|
else if (frequency_hz <= 12000)
|
|
|
|
|
channels_[channel]->max_encoding_bandwidth = kOpusBandwidthMb;
|
|
|
|
|
else if (frequency_hz <= 16000)
|
|
|
|
|
channels_[channel]->max_encoding_bandwidth = kOpusBandwidthWb;
|
|
|
|
|
else if (frequency_hz <= 24000)
|
|
|
|
|
channels_[channel]->max_encoding_bandwidth = kOpusBandwidthSwb;
|
|
|
|
|
else
|
|
|
|
|
channels_[channel]->max_encoding_bandwidth = kOpusBandwidthFb;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-03-13 09:38:07 +00:00
|
|
|
WEBRTC_FUNC(SetOpusDtx, (int channel, bool enable_dtx)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
if (_stricmp(channels_[channel]->send_codec.plname, "opus") != 0) {
|
|
|
|
|
// Return -1 if current send codec is not Opus.
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
channels_[channel]->opus_dtx = enable_dtx;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
// webrtc::VoEHardware
|
2015-12-08 09:50:23 -08:00
|
|
|
WEBRTC_STUB(GetNumOfRecordingDevices, (int& num));
|
|
|
|
|
WEBRTC_STUB(GetNumOfPlayoutDevices, (int& num));
|
|
|
|
|
WEBRTC_STUB(GetRecordingDeviceName, (int i, char* name, char* guid));
|
|
|
|
|
WEBRTC_STUB(GetPlayoutDeviceName, (int i, char* name, char* guid));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(SetRecordingDevice, (int, webrtc::StereoChannel));
|
|
|
|
|
WEBRTC_STUB(SetPlayoutDevice, (int));
|
|
|
|
|
WEBRTC_STUB(SetAudioDeviceLayer, (webrtc::AudioLayers));
|
|
|
|
|
WEBRTC_STUB(GetAudioDeviceLayer, (webrtc::AudioLayers&));
|
2016-04-08 05:35:48 -07:00
|
|
|
WEBRTC_STUB(SetRecordingSampleRate, (unsigned int samples_per_sec));
|
|
|
|
|
WEBRTC_STUB_CONST(RecordingSampleRate, (unsigned int* samples_per_sec));
|
|
|
|
|
WEBRTC_STUB(SetPlayoutSampleRate, (unsigned int samples_per_sec));
|
|
|
|
|
WEBRTC_STUB_CONST(PlayoutSampleRate, (unsigned int* samples_per_sec));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(EnableBuiltInAEC, (bool enable));
|
2016-04-29 06:09:15 -07:00
|
|
|
bool BuiltInAECIsAvailable() const override { return false; }
|
2015-09-23 14:08:33 +02:00
|
|
|
WEBRTC_STUB(EnableBuiltInAGC, (bool enable));
|
2016-04-29 06:09:15 -07:00
|
|
|
bool BuiltInAGCIsAvailable() const override { return false; }
|
2015-09-23 14:08:33 +02:00
|
|
|
WEBRTC_STUB(EnableBuiltInNS, (bool enable));
|
2016-04-29 06:09:15 -07:00
|
|
|
bool BuiltInNSIsAvailable() const override { return false; }
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// webrtc::VoERTP_RTCP
|
|
|
|
|
WEBRTC_FUNC(SetLocalSSRC, (int channel, unsigned int ssrc)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->send_ssrc = ssrc;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-10-27 03:35:21 -07:00
|
|
|
WEBRTC_STUB(GetLocalSSRC, (int channel, unsigned int& ssrc));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(GetRemoteSSRC, (int channel, unsigned int& ssrc));
|
2015-11-16 07:34:50 -08:00
|
|
|
WEBRTC_STUB(SetSendAudioLevelIndicationStatus, (int channel, bool enable,
|
|
|
|
|
unsigned char id));
|
2015-11-20 09:59:34 -08:00
|
|
|
WEBRTC_STUB(SetReceiveAudioLevelIndicationStatus, (int channel, bool enable,
|
|
|
|
|
unsigned char id));
|
2015-11-16 07:34:50 -08:00
|
|
|
WEBRTC_STUB(SetSendAbsoluteSenderTimeStatus, (int channel, bool enable,
|
|
|
|
|
unsigned char id));
|
2015-11-20 09:59:34 -08:00
|
|
|
WEBRTC_STUB(SetReceiveAbsoluteSenderTimeStatus, (int channel, bool enable,
|
|
|
|
|
unsigned char id));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(SetRTCPStatus, (int channel, bool enable));
|
|
|
|
|
WEBRTC_STUB(GetRTCPStatus, (int channel, bool& enabled));
|
|
|
|
|
WEBRTC_STUB(SetRTCP_CNAME, (int channel, const char cname[256]));
|
|
|
|
|
WEBRTC_STUB(GetRTCP_CNAME, (int channel, char cname[256]));
|
|
|
|
|
WEBRTC_STUB(GetRemoteRTCP_CNAME, (int channel, char* cname));
|
|
|
|
|
WEBRTC_STUB(GetRemoteRTCPData, (int channel, unsigned int& NTPHigh,
|
|
|
|
|
unsigned int& NTPLow,
|
|
|
|
|
unsigned int& timestamp,
|
|
|
|
|
unsigned int& playoutTimestamp,
|
|
|
|
|
unsigned int* jitter,
|
|
|
|
|
unsigned short* fractionLost));
|
2015-10-27 03:35:21 -07:00
|
|
|
WEBRTC_STUB(GetRemoteRTCPReportBlocks,
|
|
|
|
|
(int channel, std::vector<webrtc::ReportBlock>* receive_blocks));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(GetRTPStatistics, (int channel, unsigned int& averageJitterMs,
|
|
|
|
|
unsigned int& maxJitterMs,
|
|
|
|
|
unsigned int& discardedPackets));
|
2015-10-27 03:35:21 -07:00
|
|
|
WEBRTC_STUB(GetRTCPStatistics, (int channel, webrtc::CallStatistics& stats));
|
2014-06-17 10:56:41 +00:00
|
|
|
WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
2014-06-17 10:56:41 +00:00
|
|
|
channels_[channel]->red = enable;
|
|
|
|
|
channels_[channel]->red_type = redPayloadtype;
|
2013-07-10 00:45:36 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
2014-06-17 10:56:41 +00:00
|
|
|
WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) {
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
2014-06-17 10:56:41 +00:00
|
|
|
enable = channels_[channel]->red;
|
|
|
|
|
redPayloadtype = channels_[channel]->red_type;
|
2013-07-10 00:45:36 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->nack = enable;
|
|
|
|
|
channels_[channel]->nack_max_packets = maxNoPackets;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// webrtc::VoEVolumeControl
|
|
|
|
|
WEBRTC_STUB(SetSpeakerVolume, (unsigned int));
|
|
|
|
|
WEBRTC_STUB(GetSpeakerVolume, (unsigned int&));
|
|
|
|
|
WEBRTC_STUB(SetMicVolume, (unsigned int));
|
|
|
|
|
WEBRTC_STUB(GetMicVolume, (unsigned int&));
|
|
|
|
|
WEBRTC_STUB(SetInputMute, (int, bool));
|
|
|
|
|
WEBRTC_STUB(GetInputMute, (int, bool&));
|
|
|
|
|
WEBRTC_STUB(GetSpeechInputLevel, (unsigned int&));
|
|
|
|
|
WEBRTC_STUB(GetSpeechOutputLevel, (int, unsigned int&));
|
|
|
|
|
WEBRTC_STUB(GetSpeechInputLevelFullRange, (unsigned int&));
|
|
|
|
|
WEBRTC_STUB(GetSpeechOutputLevelFullRange, (int, unsigned int&));
|
|
|
|
|
WEBRTC_FUNC(SetChannelOutputVolumeScaling, (int channel, float scale)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
channels_[channel]->volume_scale= scale;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetChannelOutputVolumeScaling, (int channel, float& scale)) {
|
|
|
|
|
WEBRTC_CHECK_CHANNEL(channel);
|
|
|
|
|
scale = channels_[channel]->volume_scale;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-10-09 02:32:53 -07:00
|
|
|
WEBRTC_STUB(SetOutputVolumePan, (int channel, float left, float right));
|
|
|
|
|
WEBRTC_STUB(GetOutputVolumePan, (int channel, float& left, float& right));
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// webrtc::VoEAudioProcessing
|
|
|
|
|
WEBRTC_FUNC(SetNsStatus, (bool enable, webrtc::NsModes mode)) {
|
|
|
|
|
ns_enabled_ = enable;
|
|
|
|
|
ns_mode_ = mode;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetNsStatus, (bool& enabled, webrtc::NsModes& mode)) {
|
|
|
|
|
enabled = ns_enabled_;
|
|
|
|
|
mode = ns_mode_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WEBRTC_FUNC(SetAgcStatus, (bool enable, webrtc::AgcModes mode)) {
|
|
|
|
|
agc_enabled_ = enable;
|
|
|
|
|
agc_mode_ = mode;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetAgcStatus, (bool& enabled, webrtc::AgcModes& mode)) {
|
|
|
|
|
enabled = agc_enabled_;
|
|
|
|
|
mode = agc_mode_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WEBRTC_FUNC(SetAgcConfig, (webrtc::AgcConfig config)) {
|
|
|
|
|
agc_config_ = config;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetAgcConfig, (webrtc::AgcConfig& config)) {
|
|
|
|
|
config = agc_config_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(SetEcStatus, (bool enable, webrtc::EcModes mode)) {
|
|
|
|
|
ec_enabled_ = enable;
|
|
|
|
|
ec_mode_ = mode;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetEcStatus, (bool& enabled, webrtc::EcModes& mode)) {
|
|
|
|
|
enabled = ec_enabled_;
|
|
|
|
|
mode = ec_mode_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_STUB(EnableDriftCompensation, (bool enable))
|
|
|
|
|
WEBRTC_BOOL_STUB(DriftCompensationEnabled, ())
|
|
|
|
|
WEBRTC_VOID_STUB(SetDelayOffsetMs, (int offset))
|
|
|
|
|
WEBRTC_STUB(DelayOffsetMs, ());
|
|
|
|
|
WEBRTC_FUNC(SetAecmMode, (webrtc::AecmModes mode, bool enableCNG)) {
|
|
|
|
|
aecm_mode_ = mode;
|
|
|
|
|
cng_enabled_ = enableCNG;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetAecmMode, (webrtc::AecmModes& mode, bool& enabledCNG)) {
|
|
|
|
|
mode = aecm_mode_;
|
|
|
|
|
enabledCNG = cng_enabled_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_STUB(SetRxNsStatus, (int channel, bool enable, webrtc::NsModes mode));
|
|
|
|
|
WEBRTC_STUB(GetRxNsStatus, (int channel, bool& enabled,
|
|
|
|
|
webrtc::NsModes& mode));
|
2015-10-09 01:37:09 -07:00
|
|
|
WEBRTC_STUB(SetRxAgcStatus, (int channel, bool enable,
|
|
|
|
|
webrtc::AgcModes mode));
|
|
|
|
|
WEBRTC_STUB(GetRxAgcStatus, (int channel, bool& enabled,
|
|
|
|
|
webrtc::AgcModes& mode));
|
|
|
|
|
WEBRTC_STUB(SetRxAgcConfig, (int channel, webrtc::AgcConfig config));
|
|
|
|
|
WEBRTC_STUB(GetRxAgcConfig, (int channel, webrtc::AgcConfig& config));
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
WEBRTC_STUB(RegisterRxVadObserver, (int, webrtc::VoERxVadCallback&));
|
|
|
|
|
WEBRTC_STUB(DeRegisterRxVadObserver, (int channel));
|
|
|
|
|
WEBRTC_STUB(VoiceActivityIndicator, (int channel));
|
|
|
|
|
WEBRTC_FUNC(SetEcMetricsStatus, (bool enable)) {
|
|
|
|
|
ec_metrics_enabled_ = enable;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2015-10-27 03:35:21 -07:00
|
|
|
WEBRTC_STUB(GetEcMetricsStatus, (bool& enabled));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(GetEchoMetrics, (int& ERL, int& ERLE, int& RERL, int& A_NLP));
|
2015-02-05 12:52:44 +00:00
|
|
|
WEBRTC_STUB(GetEcDelayMetrics, (int& delay_median, int& delay_std,
|
|
|
|
|
float& fraction_poor_delays));
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
WEBRTC_STUB(StartDebugRecording, (const char* fileNameUTF8));
|
2013-12-11 18:25:07 +00:00
|
|
|
WEBRTC_STUB(StartDebugRecording, (FILE* handle));
|
2013-07-10 00:45:36 +00:00
|
|
|
WEBRTC_STUB(StopDebugRecording, ());
|
|
|
|
|
|
|
|
|
|
WEBRTC_FUNC(SetTypingDetectionStatus, (bool enable)) {
|
|
|
|
|
typing_detection_enabled_ = enable;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
WEBRTC_FUNC(GetTypingDetectionStatus, (bool& enabled)) {
|
|
|
|
|
enabled = typing_detection_enabled_;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WEBRTC_STUB(TimeSinceLastTyping, (int& seconds));
|
|
|
|
|
WEBRTC_STUB(SetTypingDetectionParameters, (int timeWindow,
|
|
|
|
|
int costPerTyping,
|
|
|
|
|
int reportingThreshold,
|
|
|
|
|
int penaltyDecay,
|
|
|
|
|
int typeEventDelay));
|
2016-04-29 06:09:15 -07:00
|
|
|
int EnableHighPassFilter(bool enable) override {
|
2013-07-10 00:45:36 +00:00
|
|
|
highpass_filter_enabled_ = enable;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-04-29 06:09:15 -07:00
|
|
|
bool IsHighPassFilterEnabled() override {
|
2013-07-10 00:45:36 +00:00
|
|
|
return highpass_filter_enabled_;
|
|
|
|
|
}
|
2016-04-29 06:09:15 -07:00
|
|
|
bool IsStereoChannelSwappingEnabled() override {
|
2013-07-10 00:45:36 +00:00
|
|
|
return stereo_swapping_enabled_;
|
|
|
|
|
}
|
2016-04-29 06:09:15 -07:00
|
|
|
void EnableStereoChannelSwapping(bool enable) override {
|
2013-07-10 00:45:36 +00:00
|
|
|
stereo_swapping_enabled_ = enable;
|
|
|
|
|
}
|
2015-05-11 12:44:23 +02:00
|
|
|
int GetNetEqCapacity() const {
|
|
|
|
|
auto ch = channels_.find(last_channel_);
|
|
|
|
|
ASSERT(ch != channels_.end());
|
|
|
|
|
return ch->second->neteq_capacity;
|
|
|
|
|
}
|
2015-06-01 10:29:41 +02:00
|
|
|
bool GetNetEqFastAccelerate() const {
|
|
|
|
|
auto ch = channels_.find(last_channel_);
|
|
|
|
|
ASSERT(ch != channels_.end());
|
|
|
|
|
return ch->second->neteq_fast_accelerate;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
private:
|
2016-04-04 09:54:44 -07:00
|
|
|
bool inited_ = false;
|
|
|
|
|
int last_channel_ = -1;
|
2013-07-10 00:45:36 +00:00
|
|
|
std::map<int, Channel*> channels_;
|
2016-04-04 09:54:44 -07:00
|
|
|
bool fail_create_channel_ = false;
|
|
|
|
|
int num_set_send_codecs_ = 0; // how many times we call SetSendCodec().
|
|
|
|
|
bool ec_enabled_ = false;
|
|
|
|
|
bool ec_metrics_enabled_ = false;
|
|
|
|
|
bool cng_enabled_ = false;
|
|
|
|
|
bool ns_enabled_ = false;
|
|
|
|
|
bool agc_enabled_ = false;
|
|
|
|
|
bool highpass_filter_enabled_ = false;
|
|
|
|
|
bool stereo_swapping_enabled_ = false;
|
|
|
|
|
bool typing_detection_enabled_ = false;
|
|
|
|
|
webrtc::EcModes ec_mode_ = webrtc::kEcDefault;
|
|
|
|
|
webrtc::AecmModes aecm_mode_ = webrtc::kAecmSpeakerphone;
|
|
|
|
|
webrtc::NsModes ns_mode_ = webrtc::kNsDefault;
|
|
|
|
|
webrtc::AgcModes agc_mode_ = webrtc::kAgcDefault;
|
2013-07-10 00:45:36 +00:00
|
|
|
webrtc::AgcConfig agc_config_;
|
2016-04-04 09:54:44 -07:00
|
|
|
int playout_fail_channel_ = -1;
|
2014-07-16 14:23:08 +00:00
|
|
|
FakeAudioProcessing audio_processing_;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace cricket
|
|
|
|
|
|
2016-02-12 06:39:40 +01:00
|
|
|
#endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVOICEENGINE_H_
|