Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: webrtc/voice_engine/channel_proxy.cc

Issue 2705093002: Injectable audio encoders: WebRtcVoiceEngine and company (Closed)
Patch Set: Channel::GetSendCodec asks both its acm and its codec manager. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« webrtc/voice_engine/channel.cc ('K') | « webrtc/voice_engine/channel_proxy.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel_proxy.cc
diff --git a/webrtc/voice_engine/channel_proxy.cc b/webrtc/voice_engine/channel_proxy.cc
index 74234a232dd8cf8f8fb376663cc0a9f4703137d7..25978c7c597fcbcfa59dc157f26784f68e83e8fb 100644
--- a/webrtc/voice_engine/channel_proxy.cc
+++ b/webrtc/voice_engine/channel_proxy.cc
@@ -36,6 +36,12 @@ bool ChannelProxy::SetEncoder(int payload_type,
return channel()->SetEncoder(payload_type, std::move(encoder));
}
+void ChannelProxy::ModifyEncoder(
+ rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier) {
+ RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
+ channel()->ModifyEncoder(modifier);
+}
+
void ChannelProxy::SetRTCPStatus(bool enable) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
channel()->SetRTCPStatus(enable);
@@ -235,24 +241,6 @@ void ChannelProxy::SetRtcEventLog(RtcEventLog* event_log) {
channel()->SetRtcEventLog(event_log);
}
-void ChannelProxy::EnableAudioNetworkAdaptor(const std::string& config_string) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- bool ret = channel()->EnableAudioNetworkAdaptor(config_string);
- RTC_DCHECK(ret);
-;}
-
-void ChannelProxy::DisableAudioNetworkAdaptor() {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- channel()->DisableAudioNetworkAdaptor();
-}
-
-void ChannelProxy::SetReceiverFrameLengthRange(int min_frame_length_ms,
- int max_frame_length_ms) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- channel()->SetReceiverFrameLengthRange(min_frame_length_ms,
- max_frame_length_ms);
-}
-
AudioMixer::Source::AudioFrameInfo ChannelProxy::GetAudioFrameWithInfo(
int sample_rate_hz,
AudioFrame* audio_frame) {
@@ -319,69 +307,6 @@ bool ChannelProxy::GetRecCodec(CodecInst* codec_inst) const {
return channel()->GetRecCodec(*codec_inst) == 0;
}
-bool ChannelProxy::GetSendCodec(CodecInst* codec_inst) const {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- return channel()->GetSendCodec(*codec_inst) == 0;
-}
-
-bool ChannelProxy::SetVADStatus(bool enable) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- return channel()->SetVADStatus(enable, VADNormal, false) == 0;
-}
-
-bool ChannelProxy::SetCodecFECStatus(bool enable) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- return channel()->SetCodecFECStatus(enable) == 0;
-}
-
-bool ChannelProxy::SetOpusDtx(bool enable) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- return channel()->SetOpusDtx(enable) == 0;
-}
-
-bool ChannelProxy::SetOpusMaxPlaybackRate(int frequency_hz) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- return channel()->SetOpusMaxPlaybackRate(frequency_hz) == 0;
-}
-
-bool ChannelProxy::SetSendCodec(const CodecInst& codec_inst) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- // Validation code copied from VoECodecImpl::SetSendCodec().
- if ((STR_CASE_CMP(codec_inst.plname, "L16") == 0) &&
- (codec_inst.pacsize >= 960)) {
- return false;
- }
- if (!STR_CASE_CMP(codec_inst.plname, "CN") ||
- !STR_CASE_CMP(codec_inst.plname, "TELEPHONE-EVENT") ||
- !STR_CASE_CMP(codec_inst.plname, "RED")) {
- return false;
- }
- if ((codec_inst.channels != 1) && (codec_inst.channels != 2)) {
- return false;
- }
- if (!AudioCodingModule::IsCodecValid(codec_inst)) {
- return false;
- }
- return channel()->SetSendCodec(codec_inst) == 0;
-}
-
-bool ChannelProxy::SetSendCNPayloadType(int type,
- PayloadFrequencies frequency) {
- RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- // Validation code copied from VoECodecImpl::SetSendCNPayloadType().
- if (type < 96 || type > 127) {
- // Only allow dynamic range: 96 to 127
- return false;
- }
- if ((frequency != kFreq16000Hz) && (frequency != kFreq32000Hz)) {
- // It is not possible to modify the payload type for CN/8000.
- // We only allow modification of the CN payload type for CN/16000
- // and CN/32000.
- return false;
- }
- return channel()->SetSendCNPayloadType(type, frequency) == 0;
-}
-
void ChannelProxy::OnTwccBasedUplinkPacketLossRate(float packet_loss_rate) {
// TODO(elad.alon): This fails in UT; fix and uncomment.
// See: https://bugs.chromium.org/p/webrtc/issues/detail?id=7405
« webrtc/voice_engine/channel.cc ('K') | « webrtc/voice_engine/channel_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698