(Auto)update libjingle 69359922-> 69365993
git-svn-id: http://webrtc.googlecode.com/svn/trunk@6463 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
d42da54768
commit
ae740dd94c
@ -97,7 +97,8 @@ class FakeWebRtcVoiceEngine
|
|||||||
volume_pan_right(1.0),
|
volume_pan_right(1.0),
|
||||||
file(false),
|
file(false),
|
||||||
vad(false),
|
vad(false),
|
||||||
fec(false),
|
codec_fec(false),
|
||||||
|
red(false),
|
||||||
nack(false),
|
nack(false),
|
||||||
media_processor_registered(false),
|
media_processor_registered(false),
|
||||||
rx_agc_enabled(false),
|
rx_agc_enabled(false),
|
||||||
@ -105,7 +106,7 @@ class FakeWebRtcVoiceEngine
|
|||||||
cn8_type(13),
|
cn8_type(13),
|
||||||
cn16_type(105),
|
cn16_type(105),
|
||||||
dtmf_type(106),
|
dtmf_type(106),
|
||||||
fec_type(117),
|
red_type(117),
|
||||||
nack_max_packets(0),
|
nack_max_packets(0),
|
||||||
vie_network(NULL),
|
vie_network(NULL),
|
||||||
video_channel(-1),
|
video_channel(-1),
|
||||||
@ -125,7 +126,8 @@ class FakeWebRtcVoiceEngine
|
|||||||
float volume_pan_right;
|
float volume_pan_right;
|
||||||
bool file;
|
bool file;
|
||||||
bool vad;
|
bool vad;
|
||||||
bool fec;
|
bool codec_fec;
|
||||||
|
bool red;
|
||||||
bool nack;
|
bool nack;
|
||||||
bool media_processor_registered;
|
bool media_processor_registered;
|
||||||
bool rx_agc_enabled;
|
bool rx_agc_enabled;
|
||||||
@ -134,7 +136,7 @@ class FakeWebRtcVoiceEngine
|
|||||||
int cn8_type;
|
int cn8_type;
|
||||||
int cn16_type;
|
int cn16_type;
|
||||||
int dtmf_type;
|
int dtmf_type;
|
||||||
int fec_type;
|
int red_type;
|
||||||
int nack_max_packets;
|
int nack_max_packets;
|
||||||
webrtc::ViENetwork* vie_network;
|
webrtc::ViENetwork* vie_network;
|
||||||
int video_channel;
|
int video_channel;
|
||||||
@ -215,8 +217,11 @@ class FakeWebRtcVoiceEngine
|
|||||||
bool GetVAD(int channel) {
|
bool GetVAD(int channel) {
|
||||||
return channels_[channel]->vad;
|
return channels_[channel]->vad;
|
||||||
}
|
}
|
||||||
bool GetFEC(int channel) {
|
bool GetRED(int channel) {
|
||||||
return channels_[channel]->fec;
|
return channels_[channel]->red;
|
||||||
|
}
|
||||||
|
bool GetCodecFEC(int channel) {
|
||||||
|
return channels_[channel]->codec_fec;
|
||||||
}
|
}
|
||||||
bool GetNACK(int channel) {
|
bool GetNACK(int channel) {
|
||||||
return channels_[channel]->nack;
|
return channels_[channel]->nack;
|
||||||
@ -244,8 +249,8 @@ class FakeWebRtcVoiceEngine
|
|||||||
int GetSendTelephoneEventPayloadType(int channel) {
|
int GetSendTelephoneEventPayloadType(int channel) {
|
||||||
return channels_[channel]->dtmf_type;
|
return channels_[channel]->dtmf_type;
|
||||||
}
|
}
|
||||||
int GetSendFECPayloadType(int channel) {
|
int GetSendREDPayloadType(int channel) {
|
||||||
return channels_[channel]->fec_type;
|
return channels_[channel]->red_type;
|
||||||
}
|
}
|
||||||
bool CheckPacket(int channel, const void* data, size_t len) {
|
bool CheckPacket(int channel, const void* data, size_t len) {
|
||||||
bool result = !CheckNoPacket(channel);
|
bool result = !CheckNoPacket(channel);
|
||||||
@ -531,6 +536,18 @@ class FakeWebRtcVoiceEngine
|
|||||||
}
|
}
|
||||||
WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
|
WEBRTC_STUB(GetVADStatus, (int channel, bool& enabled,
|
||||||
webrtc::VadModes& mode, bool& disabledDTX));
|
webrtc::VadModes& mode, bool& disabledDTX));
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable)) {
|
||||||
|
WEBRTC_CHECK_CHANNEL(channel);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
|
|
||||||
// webrtc::VoEDtmf
|
// webrtc::VoEDtmf
|
||||||
WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
|
WEBRTC_FUNC(SendTelephoneEvent, (int channel, int event_code,
|
||||||
@ -843,16 +860,24 @@ class FakeWebRtcVoiceEngine
|
|||||||
stats.packetsReceived = kIntStatValue;
|
stats.packetsReceived = kIntStatValue;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
WEBRTC_FUNC(SetREDStatus, (int channel, bool enable, int redPayloadtype)) {
|
||||||
|
#else
|
||||||
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
|
WEBRTC_FUNC(SetFECStatus, (int channel, bool enable, int redPayloadtype)) {
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
WEBRTC_CHECK_CHANNEL(channel);
|
WEBRTC_CHECK_CHANNEL(channel);
|
||||||
channels_[channel]->fec = enable;
|
channels_[channel]->red = enable;
|
||||||
channels_[channel]->fec_type = redPayloadtype;
|
channels_[channel]->red_type = redPayloadtype;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
WEBRTC_FUNC(GetREDStatus, (int channel, bool& enable, int& redPayloadtype)) {
|
||||||
|
#else
|
||||||
WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
|
WEBRTC_FUNC(GetFECStatus, (int channel, bool& enable, int& redPayloadtype)) {
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
WEBRTC_CHECK_CHANNEL(channel);
|
WEBRTC_CHECK_CHANNEL(channel);
|
||||||
enable = channels_[channel]->fec;
|
enable = channels_[channel]->red;
|
||||||
redPayloadtype = channels_[channel]->fec_type;
|
redPayloadtype = channels_[channel]->red_type;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
|
WEBRTC_FUNC(SetNACKStatus, (int channel, bool enable, int maxNoPackets)) {
|
||||||
|
@ -558,6 +558,7 @@ class WebRtcOveruseObserver : public webrtc::CpuOveruseObserver {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Enable(bool enable) {
|
void Enable(bool enable) {
|
||||||
|
LOG(LS_INFO) << "WebRtcOveruseObserver enable: " << enable;
|
||||||
talk_base::CritScope cs(&crit_);
|
talk_base::CritScope cs(&crit_);
|
||||||
enabled_ = enable;
|
enabled_ = enable;
|
||||||
}
|
}
|
||||||
@ -586,8 +587,7 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
external_capture_(external_capture),
|
external_capture_(external_capture),
|
||||||
capturer_updated_(false),
|
capturer_updated_(false),
|
||||||
interval_(0),
|
interval_(0),
|
||||||
cpu_monitor_(cpu_monitor),
|
cpu_monitor_(cpu_monitor) {
|
||||||
overuse_observer_enabled_(false) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int channel_id() const { return channel_id_; }
|
int channel_id() const { return channel_id_; }
|
||||||
@ -679,7 +679,8 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
vie_wrapper->base()->RegisterCpuOveruseObserver(channel_id_,
|
vie_wrapper->base()->RegisterCpuOveruseObserver(channel_id_,
|
||||||
overuse_observer_.get());
|
overuse_observer_.get());
|
||||||
// (Dis)connect the video adapter from the cpu monitor as appropriate.
|
// (Dis)connect the video adapter from the cpu monitor as appropriate.
|
||||||
SetCpuOveruseDetection(overuse_observer_enabled_);
|
SetCpuOveruseDetection(
|
||||||
|
video_options_.cpu_overuse_detection.GetWithDefaultIfUnset(false));
|
||||||
|
|
||||||
SignalCpuAdaptationUnable.repeat(adapter->SignalCpuAdaptationUnable);
|
SignalCpuAdaptationUnable.repeat(adapter->SignalCpuAdaptationUnable);
|
||||||
}
|
}
|
||||||
@ -698,10 +699,18 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ApplyCpuOptions(const VideoOptions& video_options) {
|
void ApplyCpuOptions(const VideoOptions& video_options) {
|
||||||
|
bool cpu_overuse_detection_changed =
|
||||||
|
video_options.cpu_overuse_detection.IsSet() &&
|
||||||
|
(video_options.cpu_overuse_detection.GetWithDefaultIfUnset(false) !=
|
||||||
|
video_options_.cpu_overuse_detection.GetWithDefaultIfUnset(false));
|
||||||
// Use video_options_.SetAll() instead of assignment so that unset value in
|
// Use video_options_.SetAll() instead of assignment so that unset value in
|
||||||
// video_options will not overwrite the previous option value.
|
// video_options will not overwrite the previous option value.
|
||||||
video_options_.SetAll(video_options);
|
video_options_.SetAll(video_options);
|
||||||
UpdateAdapterCpuOptions();
|
UpdateAdapterCpuOptions();
|
||||||
|
if (cpu_overuse_detection_changed) {
|
||||||
|
SetCpuOveruseDetection(
|
||||||
|
video_options_.cpu_overuse_detection.GetWithDefaultIfUnset(false));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAdapterCpuOptions() {
|
void UpdateAdapterCpuOptions() {
|
||||||
@ -709,15 +718,19 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cpu_adapt, cpu_smoothing, adapt_third;
|
bool cpu_smoothing, adapt_third;
|
||||||
float low, med, high;
|
float low, med, high;
|
||||||
|
bool cpu_adapt =
|
||||||
|
video_options_.adapt_input_to_cpu_usage.GetWithDefaultIfUnset(false);
|
||||||
|
bool cpu_overuse_detection =
|
||||||
|
video_options_.cpu_overuse_detection.GetWithDefaultIfUnset(false);
|
||||||
|
|
||||||
// TODO(thorcarpenter): Have VideoAdapter be responsible for setting
|
// TODO(thorcarpenter): Have VideoAdapter be responsible for setting
|
||||||
// all these video options.
|
// all these video options.
|
||||||
CoordinatedVideoAdapter* video_adapter = video_capturer_->video_adapter();
|
CoordinatedVideoAdapter* video_adapter = video_capturer_->video_adapter();
|
||||||
if (video_options_.adapt_input_to_cpu_usage.Get(&cpu_adapt) ||
|
if (video_options_.adapt_input_to_cpu_usage.IsSet() ||
|
||||||
overuse_observer_enabled_) {
|
video_options_.cpu_overuse_detection.IsSet()) {
|
||||||
video_adapter->set_cpu_adaptation(cpu_adapt || overuse_observer_enabled_);
|
video_adapter->set_cpu_adaptation(cpu_adapt || cpu_overuse_detection);
|
||||||
}
|
}
|
||||||
if (video_options_.adapt_cpu_with_smoothing.Get(&cpu_smoothing)) {
|
if (video_options_.adapt_cpu_with_smoothing.Get(&cpu_smoothing)) {
|
||||||
video_adapter->set_cpu_smoothing(cpu_smoothing);
|
video_adapter->set_cpu_smoothing(cpu_smoothing);
|
||||||
@ -737,8 +750,6 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetCpuOveruseDetection(bool enable) {
|
void SetCpuOveruseDetection(bool enable) {
|
||||||
overuse_observer_enabled_ = enable;
|
|
||||||
|
|
||||||
if (overuse_observer_) {
|
if (overuse_observer_) {
|
||||||
overuse_observer_->Enable(enable);
|
overuse_observer_->Enable(enable);
|
||||||
}
|
}
|
||||||
@ -747,10 +758,6 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
// it will be signaled by cpu monitor.
|
// it will be signaled by cpu monitor.
|
||||||
CoordinatedVideoAdapter* adapter = video_adapter();
|
CoordinatedVideoAdapter* adapter = video_adapter();
|
||||||
if (adapter) {
|
if (adapter) {
|
||||||
bool cpu_adapt = false;
|
|
||||||
video_options_.adapt_input_to_cpu_usage.Get(&cpu_adapt);
|
|
||||||
adapter->set_cpu_adaptation(
|
|
||||||
adapter->cpu_adaptation() || cpu_adapt || enable);
|
|
||||||
if (cpu_monitor_) {
|
if (cpu_monitor_) {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
cpu_monitor_->SignalUpdate.disconnect(adapter);
|
cpu_monitor_->SignalUpdate.disconnect(adapter);
|
||||||
@ -815,7 +822,6 @@ class WebRtcVideoChannelSendInfo : public sigslot::has_slots<> {
|
|||||||
|
|
||||||
talk_base::CpuMonitor* cpu_monitor_;
|
talk_base::CpuMonitor* cpu_monitor_;
|
||||||
talk_base::scoped_ptr<WebRtcOveruseObserver> overuse_observer_;
|
talk_base::scoped_ptr<WebRtcOveruseObserver> overuse_observer_;
|
||||||
bool overuse_observer_enabled_;
|
|
||||||
|
|
||||||
VideoOptions video_options_;
|
VideoOptions video_options_;
|
||||||
};
|
};
|
||||||
@ -2967,9 +2973,6 @@ bool WebRtcVideoMediaChannel::SetOptions(const VideoOptions &options) {
|
|||||||
bool buffer_latency_changed = options.buffered_mode_latency.IsSet() &&
|
bool buffer_latency_changed = options.buffered_mode_latency.IsSet() &&
|
||||||
(options_.buffered_mode_latency != options.buffered_mode_latency);
|
(options_.buffered_mode_latency != options.buffered_mode_latency);
|
||||||
|
|
||||||
bool cpu_overuse_detection_changed = options.cpu_overuse_detection.IsSet() &&
|
|
||||||
(options_.cpu_overuse_detection != options.cpu_overuse_detection);
|
|
||||||
|
|
||||||
bool dscp_option_changed = (options_.dscp != options.dscp);
|
bool dscp_option_changed = (options_.dscp != options.dscp);
|
||||||
|
|
||||||
bool suspend_below_min_bitrate_changed =
|
bool suspend_below_min_bitrate_changed =
|
||||||
@ -3081,17 +3084,6 @@ bool WebRtcVideoMediaChannel::SetOptions(const VideoOptions &options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cpu_overuse_detection_changed) {
|
|
||||||
bool cpu_overuse_detection =
|
|
||||||
options_.cpu_overuse_detection.GetWithDefaultIfUnset(false);
|
|
||||||
LOG(LS_INFO) << "CPU overuse detection is enabled? "
|
|
||||||
<< cpu_overuse_detection;
|
|
||||||
for (SendChannelMap::iterator iter = send_channels_.begin();
|
|
||||||
iter != send_channels_.end(); ++iter) {
|
|
||||||
WebRtcVideoChannelSendInfo* send_channel = iter->second;
|
|
||||||
send_channel->SetCpuOveruseDetection(cpu_overuse_detection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dscp_option_changed) {
|
if (dscp_option_changed) {
|
||||||
talk_base::DiffServCodePoint dscp = talk_base::DSCP_DEFAULT;
|
talk_base::DiffServCodePoint dscp = talk_base::DSCP_DEFAULT;
|
||||||
if (options_.dscp.GetWithDefaultIfUnset(false))
|
if (options_.dscp.GetWithDefaultIfUnset(false))
|
||||||
@ -3576,10 +3568,6 @@ bool WebRtcVideoMediaChannel::ConfigureSending(int channel_id,
|
|||||||
send_channel->SignalCpuAdaptationUnable.connect(this,
|
send_channel->SignalCpuAdaptationUnable.connect(this,
|
||||||
&WebRtcVideoMediaChannel::OnCpuAdaptationUnable);
|
&WebRtcVideoMediaChannel::OnCpuAdaptationUnable);
|
||||||
|
|
||||||
if (options_.cpu_overuse_detection.GetWithDefaultIfUnset(false)) {
|
|
||||||
send_channel->SetCpuOveruseDetection(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
webrtc::CpuOveruseOptions overuse_options;
|
webrtc::CpuOveruseOptions overuse_options;
|
||||||
if (GetCpuOveruseOptions(options_, &overuse_options)) {
|
if (GetCpuOveruseOptions(options_, &overuse_options)) {
|
||||||
if (engine()->vie()->base()->SetCpuOveruseOptions(channel_id,
|
if (engine()->vie()->base()->SetCpuOveruseOptions(channel_id,
|
||||||
|
@ -426,6 +426,16 @@ static int GetOpusBitrateFromParams(const AudioCodec& codec) {
|
|||||||
return bitrate;
|
return bitrate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// True if params["useinbandfec"] == "1"
|
||||||
|
static bool IsOpusFecEnabled(const AudioCodec& codec) {
|
||||||
|
CodecParameterMap::const_iterator param =
|
||||||
|
codec.params.find(kCodecParamUseInbandFec);
|
||||||
|
if (param == codec.params.end())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return param->second == kParamValueTrue;
|
||||||
|
}
|
||||||
|
|
||||||
void WebRtcVoiceEngine::ConstructCodecs() {
|
void WebRtcVoiceEngine::ConstructCodecs() {
|
||||||
LOG(LS_INFO) << "WebRtc VoiceEngine codecs:";
|
LOG(LS_INFO) << "WebRtc VoiceEngine codecs:";
|
||||||
int ncodecs = voe_wrapper_->codec()->NumOfCodecs();
|
int ncodecs = voe_wrapper_->codec()->NumOfCodecs();
|
||||||
@ -1943,10 +1953,16 @@ bool WebRtcVoiceMediaChannel::SetRecvCodecs(
|
|||||||
|
|
||||||
bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
||||||
int channel, const std::vector<AudioCodec>& codecs) {
|
int channel, const std::vector<AudioCodec>& codecs) {
|
||||||
// Disable VAD, and FEC unless we know the other side wants them.
|
// Disable VAD, FEC, and RED unless we know the other side wants them.
|
||||||
engine()->voe()->codec()->SetVADStatus(channel, false);
|
engine()->voe()->codec()->SetVADStatus(channel, false);
|
||||||
engine()->voe()->rtp()->SetNACKStatus(channel, false, 0);
|
engine()->voe()->rtp()->SetNACKStatus(channel, false, 0);
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
engine()->voe()->rtp()->SetREDStatus(channel, false);
|
||||||
|
engine()->voe()->codec()->SetFECStatus(channel, false);
|
||||||
|
#else
|
||||||
|
// TODO(minyue): Remove code under #else case after new WebRTC roll.
|
||||||
engine()->voe()->rtp()->SetFECStatus(channel, false);
|
engine()->voe()->rtp()->SetFECStatus(channel, false);
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
|
|
||||||
// Scan through the list to figure out the codec to use for sending, along
|
// Scan through the list to figure out the codec to use for sending, along
|
||||||
// with the proper configuration for VAD and DTMF.
|
// with the proper configuration for VAD and DTMF.
|
||||||
@ -2005,11 +2021,24 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
|||||||
if (bitrate_from_params != 0) {
|
if (bitrate_from_params != 0) {
|
||||||
voe_codec.rate = bitrate_from_params;
|
voe_codec.rate = bitrate_from_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If FEC is enabled.
|
||||||
|
if (IsOpusFecEnabled(*it)) {
|
||||||
|
LOG(LS_INFO) << "Enabling Opus FEC on channel " << channel;
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
if (engine()->voe()->codec()->SetFECStatus(channel, true) == -1) {
|
||||||
|
// Enable in-band FEC of the Opus codec. Treat any failure as a fatal
|
||||||
|
// internal error.
|
||||||
|
LOG_RTCERR2(SetFECStatus, channel, true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We'll use the first codec in the list to actually send audio data.
|
// We'll use the first codec in the list to actually send audio data.
|
||||||
// Be sure to use the payload type requested by the remote side.
|
// Be sure to use the payload type requested by the remote side.
|
||||||
// "red", for FEC audio, is a special case where the actual codec to be
|
// "red", for RED audio, is a special case where the actual codec to be
|
||||||
// used is specified in params.
|
// used is specified in params.
|
||||||
if (IsRedCodec(it->name)) {
|
if (IsRedCodec(it->name)) {
|
||||||
// Parse out the RED parameters. If we fail, just ignore RED;
|
// Parse out the RED parameters. If we fail, just ignore RED;
|
||||||
@ -2020,9 +2049,16 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
|||||||
|
|
||||||
// Enable redundant encoding of the specified codec. Treat any
|
// Enable redundant encoding of the specified codec. Treat any
|
||||||
// failure as a fatal internal error.
|
// failure as a fatal internal error.
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
LOG(LS_INFO) << "Enabling RED on channel " << channel;
|
||||||
|
if (engine()->voe()->rtp()->SetREDStatus(channel, true, it->id) == -1) {
|
||||||
|
LOG_RTCERR3(SetREDStatus, channel, true, it->id);
|
||||||
|
#else
|
||||||
|
// TODO(minyue): Remove code under #else case after new WebRTC roll.
|
||||||
LOG(LS_INFO) << "Enabling FEC";
|
LOG(LS_INFO) << "Enabling FEC";
|
||||||
if (engine()->voe()->rtp()->SetFECStatus(channel, true, it->id) == -1) {
|
if (engine()->voe()->rtp()->SetFECStatus(channel, true, it->id) == -1) {
|
||||||
LOG_RTCERR3(SetFECStatus, channel, true, it->id);
|
LOG_RTCERR3(SetFECStatus, channel, true, it->id);
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -745,7 +745,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) {
|
|||||||
EXPECT_EQ(48000, gcodec.rate);
|
EXPECT_EQ(48000, gcodec.rate);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetVAD(channel_num));
|
EXPECT_FALSE(voe_.GetVAD(channel_num));
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
||||||
EXPECT_EQ(105, voe_.GetSendCNPayloadType(channel_num, true));
|
EXPECT_EQ(105, voe_.GetSendCNPayloadType(channel_num, true));
|
||||||
EXPECT_EQ(106, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
EXPECT_EQ(106, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
||||||
@ -1144,6 +1144,81 @@ TEST_F(WebRtcVoiceEngineTestFake, AddRecvStreamEnableNack) {
|
|||||||
EXPECT_TRUE(voe_.GetNACK(channel_num));
|
EXPECT_TRUE(voe_.GetNACK(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_WEBRTC_DEV_BRANCH
|
||||||
|
// Test that without useinbandfec, Opus FEC is off.
|
||||||
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecNoOpusFEC) {
|
||||||
|
EXPECT_TRUE(SetupEngine());
|
||||||
|
int channel_num = voe_.GetLastChannel();
|
||||||
|
std::vector<cricket::AudioCodec> codecs;
|
||||||
|
codecs.push_back(kOpusCodec);
|
||||||
|
codecs[0].bitrate = 0;
|
||||||
|
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||||
|
EXPECT_FALSE(voe_.GetCodecFEC(channel_num));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that with useinbandfec=0, Opus FEC is off.
|
||||||
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecOpusDisableFEC) {
|
||||||
|
EXPECT_TRUE(SetupEngine());
|
||||||
|
int channel_num = voe_.GetLastChannel();
|
||||||
|
std::vector<cricket::AudioCodec> codecs;
|
||||||
|
codecs.push_back(kOpusCodec);
|
||||||
|
codecs[0].bitrate = 0;
|
||||||
|
codecs[0].params["useinbandfec"] = "0";
|
||||||
|
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||||
|
EXPECT_FALSE(voe_.GetCodecFEC(channel_num));
|
||||||
|
webrtc::CodecInst gcodec;
|
||||||
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
|
EXPECT_STREQ("opus", gcodec.plname);
|
||||||
|
EXPECT_EQ(1, gcodec.channels);
|
||||||
|
EXPECT_EQ(32000, gcodec.rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that with useinbandfec=1, Opus FEC is on.
|
||||||
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecOpusEnableFEC) {
|
||||||
|
EXPECT_TRUE(SetupEngine());
|
||||||
|
int channel_num = voe_.GetLastChannel();
|
||||||
|
std::vector<cricket::AudioCodec> codecs;
|
||||||
|
codecs.push_back(kOpusCodec);
|
||||||
|
codecs[0].bitrate = 0;
|
||||||
|
codecs[0].params["useinbandfec"] = "1";
|
||||||
|
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||||
|
EXPECT_TRUE(voe_.GetCodecFEC(channel_num));
|
||||||
|
webrtc::CodecInst gcodec;
|
||||||
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
|
EXPECT_STREQ("opus", gcodec.plname);
|
||||||
|
EXPECT_EQ(1, gcodec.channels);
|
||||||
|
EXPECT_EQ(32000, gcodec.rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that with useinbandfec=1, stereo=1, Opus FEC is on.
|
||||||
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecOpusEnableFECStereo) {
|
||||||
|
EXPECT_TRUE(SetupEngine());
|
||||||
|
int channel_num = voe_.GetLastChannel();
|
||||||
|
std::vector<cricket::AudioCodec> codecs;
|
||||||
|
codecs.push_back(kOpusCodec);
|
||||||
|
codecs[0].bitrate = 0;
|
||||||
|
codecs[0].params["stereo"] = "1";
|
||||||
|
codecs[0].params["useinbandfec"] = "1";
|
||||||
|
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||||
|
EXPECT_TRUE(voe_.GetCodecFEC(channel_num));
|
||||||
|
webrtc::CodecInst gcodec;
|
||||||
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
|
EXPECT_STREQ("opus", gcodec.plname);
|
||||||
|
EXPECT_EQ(2, gcodec.channels);
|
||||||
|
EXPECT_EQ(64000, gcodec.rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test that with non-Opus, codec FEC is off.
|
||||||
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecIsacNoFEC) {
|
||||||
|
EXPECT_TRUE(SetupEngine());
|
||||||
|
int channel_num = voe_.GetLastChannel();
|
||||||
|
std::vector<cricket::AudioCodec> codecs;
|
||||||
|
codecs.push_back(kIsacCodec);
|
||||||
|
EXPECT_TRUE(channel_->SetSendCodecs(codecs));
|
||||||
|
EXPECT_FALSE(voe_.GetCodecFEC(channel_num));
|
||||||
|
}
|
||||||
|
#endif // USE_WEBRTC_DEV_BRANCH
|
||||||
|
|
||||||
// Test that we can apply CELT with stereo mode but fail with mono mode.
|
// Test that we can apply CELT with stereo mode but fail with mono mode.
|
||||||
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCelt) {
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCelt) {
|
||||||
EXPECT_TRUE(SetupEngine());
|
EXPECT_TRUE(SetupEngine());
|
||||||
@ -1315,7 +1390,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCaller) {
|
|||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
||||||
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
||||||
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
||||||
@ -1348,7 +1423,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNandDTMFAsCallee) {
|
|||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
||||||
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
||||||
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
||||||
@ -1412,13 +1487,13 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCaseInsensitive) {
|
|||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
EXPECT_TRUE(voe_.GetVAD(channel_num));
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
EXPECT_EQ(13, voe_.GetSendCNPayloadType(channel_num, false));
|
||||||
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
EXPECT_EQ(97, voe_.GetSendCNPayloadType(channel_num, true));
|
||||||
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
EXPECT_EQ(98, voe_.GetSendTelephoneEventPayloadType(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we set up FEC correctly as caller.
|
// Test that we set up RED correctly as caller.
|
||||||
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCaller) {
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCaller) {
|
||||||
EXPECT_TRUE(SetupEngine());
|
EXPECT_TRUE(SetupEngine());
|
||||||
int channel_num = voe_.GetLastChannel();
|
int channel_num = voe_.GetLastChannel();
|
||||||
@ -1434,11 +1509,11 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCaller) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetFEC(channel_num));
|
EXPECT_TRUE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(127, voe_.GetSendFECPayloadType(channel_num));
|
EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we set up FEC correctly as callee.
|
// Test that we set up RED correctly as callee.
|
||||||
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
|
||||||
EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
|
EXPECT_TRUE(engine_.Init(talk_base::Thread::Current()));
|
||||||
channel_ = engine_.CreateChannel();
|
channel_ = engine_.CreateChannel();
|
||||||
@ -1459,11 +1534,11 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDAsCallee) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetFEC(channel_num));
|
EXPECT_TRUE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(127, voe_.GetSendFECPayloadType(channel_num));
|
EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we set up FEC correctly if params are omitted.
|
// Test that we set up RED correctly if params are omitted.
|
||||||
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDNoParams) {
|
TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDNoParams) {
|
||||||
EXPECT_TRUE(SetupEngine());
|
EXPECT_TRUE(SetupEngine());
|
||||||
int channel_num = voe_.GetLastChannel();
|
int channel_num = voe_.GetLastChannel();
|
||||||
@ -1478,8 +1553,8 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsREDNoParams) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_TRUE(voe_.GetFEC(channel_num));
|
EXPECT_TRUE(voe_.GetRED(channel_num));
|
||||||
EXPECT_EQ(127, voe_.GetSendFECPayloadType(channel_num));
|
EXPECT_EQ(127, voe_.GetSendREDPayloadType(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we ignore RED if the parameters aren't named the way we expect.
|
// Test that we ignore RED if the parameters aren't named the way we expect.
|
||||||
@ -1498,7 +1573,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsBadRED1) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we ignore RED if it uses different primary/secondary encoding.
|
// Test that we ignore RED if it uses different primary/secondary encoding.
|
||||||
@ -1517,7 +1592,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsBadRED2) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we ignore RED if it uses more than 2 encodings.
|
// Test that we ignore RED if it uses more than 2 encodings.
|
||||||
@ -1536,7 +1611,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsBadRED3) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we ignore RED if it has bogus codec ids.
|
// Test that we ignore RED if it has bogus codec ids.
|
||||||
@ -1555,7 +1630,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsBadRED4) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that we ignore RED if it refers to a codec that is not present.
|
// Test that we ignore RED if it refers to a codec that is not present.
|
||||||
@ -1574,7 +1649,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsBadRED5) {
|
|||||||
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
EXPECT_EQ(0, voe_.GetSendCodec(channel_num, gcodec));
|
||||||
EXPECT_EQ(96, gcodec.pltype);
|
EXPECT_EQ(96, gcodec.pltype);
|
||||||
EXPECT_STREQ("ISAC", gcodec.plname);
|
EXPECT_STREQ("ISAC", gcodec.plname);
|
||||||
EXPECT_FALSE(voe_.GetFEC(channel_num));
|
EXPECT_FALSE(voe_.GetRED(channel_num));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test support for audio level header extension.
|
// Test support for audio level header extension.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user