mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 13:20:44 +01:00
Remove support for setting mobile aec
This commit is contained in:
parent
166228f04e
commit
16dbd7a436
8 changed files with 16 additions and 60 deletions
|
@ -151,9 +151,6 @@ class AudioDeviceModule : public webrtc::RefCountInterface {
|
|||
virtual bool BuiltInAECIsAvailable() const = 0;
|
||||
virtual bool BuiltInAGCIsAvailable() const = 0;
|
||||
virtual bool BuiltInNSIsAvailable() const = 0;
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
// When using software AEC, use AECM instead of AEC3.
|
||||
virtual bool UseAecm() const { return false; }
|
||||
|
||||
// Enables the built-in audio effects. Only supported on Android.
|
||||
virtual int32_t EnableBuiltInAEC(bool enable) = 0;
|
||||
|
|
|
@ -612,8 +612,8 @@ void WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) {
|
|||
|
||||
if (options.echo_cancellation) {
|
||||
apm_config.echo_canceller.enabled = *options.echo_cancellation;
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
apm_config.echo_canceller.mobile_mode = adm()->UseAecm();
|
||||
// RingRTC change to disable AECM
|
||||
apm_config.echo_canceller.mobile_mode = false;
|
||||
}
|
||||
|
||||
if (options.auto_gain_control) {
|
||||
|
|
|
@ -150,8 +150,6 @@ class RingRTCAudioDeviceModule : public AudioDeviceModule {
|
|||
bool BuiltInAECIsAvailable() const override { return false; }
|
||||
bool BuiltInAGCIsAvailable() const override { return false; }
|
||||
bool BuiltInNSIsAvailable() const override { return false; }
|
||||
// When using software AEC, use AECM instead of AEC3.
|
||||
bool UseAecm() const override { return false; }
|
||||
|
||||
// Enables the built-in audio effects. Only supported on Android.
|
||||
int32_t EnableBuiltInAEC(bool enable) override { return -1; }
|
||||
|
|
|
@ -50,8 +50,6 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
private boolean useStereoOutput;
|
||||
private AudioAttributes audioAttributes;
|
||||
private boolean useLowLatency;
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
private boolean useAecm;
|
||||
private boolean enableVolumeLogger;
|
||||
|
||||
private Builder(Context context) {
|
||||
|
@ -60,7 +58,6 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
this.inputSampleRate = WebRtcAudioManager.getSampleRate(audioManager);
|
||||
this.outputSampleRate = WebRtcAudioManager.getSampleRate(audioManager);
|
||||
this.useLowLatency = false;
|
||||
this.useAecm = false;
|
||||
this.enableVolumeLogger = true;
|
||||
}
|
||||
|
||||
|
@ -218,15 +215,6 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
return this;
|
||||
}
|
||||
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
/**
|
||||
* Control if AECM is used or AEC3. The default is AEC3.
|
||||
*/
|
||||
public Builder setUseAecm(boolean useAecm) {
|
||||
this.useAecm = useAecm;
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Disables the volume logger on the audio output track. */
|
||||
public Builder setEnableVolumeLogger(boolean enableVolumeLogger) {
|
||||
this.enableVolumeLogger = enableVolumeLogger;
|
||||
|
@ -272,7 +260,7 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
new WebRtcAudioTrack(context, audioManager, audioAttributes, audioTrackErrorCallback,
|
||||
audioTrackStateCallback, useLowLatency, enableVolumeLogger);
|
||||
return new JavaAudioDeviceModule(context, audioManager, audioInput, audioOutput,
|
||||
inputSampleRate, outputSampleRate, useStereoInput, useStereoOutput, useAecm);
|
||||
inputSampleRate, outputSampleRate, useStereoInput, useStereoOutput);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,15 +368,13 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
private final int outputSampleRate;
|
||||
private final boolean useStereoInput;
|
||||
private final boolean useStereoOutput;
|
||||
private final boolean useAecm;
|
||||
|
||||
private final Object nativeLock = new Object();
|
||||
private long nativeAudioDeviceModule;
|
||||
|
||||
private JavaAudioDeviceModule(Context context, AudioManager audioManager,
|
||||
WebRtcAudioRecord audioInput, WebRtcAudioTrack audioOutput, int inputSampleRate,
|
||||
int outputSampleRate, boolean useStereoInput, boolean useStereoOutput,
|
||||
boolean useAecm) {
|
||||
int outputSampleRate, boolean useStereoInput, boolean useStereoOutput) {
|
||||
this.context = context;
|
||||
this.audioManager = audioManager;
|
||||
this.audioInput = audioInput;
|
||||
|
@ -397,7 +383,6 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
this.outputSampleRate = outputSampleRate;
|
||||
this.useStereoInput = useStereoInput;
|
||||
this.useStereoOutput = useStereoOutput;
|
||||
this.useAecm = useAecm;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -405,8 +390,7 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
synchronized (nativeLock) {
|
||||
if (nativeAudioDeviceModule == 0) {
|
||||
nativeAudioDeviceModule = nativeCreateAudioDeviceModule(context, audioManager, audioInput,
|
||||
audioOutput, inputSampleRate, outputSampleRate, useStereoInput, useStereoOutput,
|
||||
useAecm);
|
||||
audioOutput, inputSampleRate, outputSampleRate, useStereoInput, useStereoOutput);
|
||||
}
|
||||
return nativeAudioDeviceModule;
|
||||
}
|
||||
|
@ -454,6 +438,5 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
|
|||
|
||||
private static native long nativeCreateAudioDeviceModule(Context context,
|
||||
AudioManager audioManager, WebRtcAudioRecord audioInput, WebRtcAudioTrack audioOutput,
|
||||
int inputSampleRate, int outputSampleRate, boolean useStereoInput, boolean useStereoOutput,
|
||||
boolean useAecm);
|
||||
int inputSampleRate, int outputSampleRate, boolean useStereoInput, boolean useStereoOutput);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,7 @@ rtc::scoped_refptr<AudioDeviceModule> CreateAAudioAudioDeviceModule(
|
|||
false /* use_stereo_output */,
|
||||
jni::kLowLatencyModeDelayEstimateInMilliseconds,
|
||||
std::make_unique<jni::AAudioRecorder>(input_parameters),
|
||||
std::make_unique<jni::AAudioPlayer>(output_parameters),
|
||||
false /* use_aecm */);
|
||||
std::make_unique<jni::AAudioPlayer>(output_parameters));
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioDeviceModule>
|
||||
|
@ -125,8 +124,7 @@ rtc::scoped_refptr<AudioDeviceModule> CreateJavaAudioDeviceModule(
|
|||
AudioDeviceModule::kAndroidJavaAudio, false /* use_stereo_input */,
|
||||
false /* use_stereo_output */,
|
||||
jni::kHighLatencyModeDelayEstimateInMilliseconds, std::move(audio_input),
|
||||
std::move(audio_output),
|
||||
false /* use_aecm */);
|
||||
std::move(audio_output));
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioDeviceModule> CreateOpenSLESAudioDeviceModule(
|
||||
|
@ -149,8 +147,7 @@ rtc::scoped_refptr<AudioDeviceModule> CreateOpenSLESAudioDeviceModule(
|
|||
AudioDeviceModule::kAndroidOpenSLESAudio, false /* use_stereo_input */,
|
||||
false /* use_stereo_output */,
|
||||
jni::kLowLatencyModeDelayEstimateInMilliseconds, std::move(audio_input),
|
||||
std::move(audio_output),
|
||||
false /* use_aecm */);
|
||||
std::move(audio_output));
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioDeviceModule>
|
||||
|
@ -179,8 +176,7 @@ CreateJavaInputAndOpenSLESOutputAudioDeviceModule(JNIEnv* env,
|
|||
AudioDeviceModule::kAndroidJavaInputAndOpenSLESOutputAudio,
|
||||
false /* use_stereo_input */, false /* use_stereo_output */,
|
||||
jni::kLowLatencyModeDelayEstimateInMilliseconds, std::move(audio_input),
|
||||
std::move(audio_output),
|
||||
false /* use_aecm */);
|
||||
std::move(audio_output));
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<AudioDeviceModule> CreateAndroidAudioDeviceModule(
|
||||
|
|
|
@ -59,9 +59,7 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||
bool is_stereo_record_supported,
|
||||
uint16_t playout_delay_ms,
|
||||
std::unique_ptr<AudioInput> audio_input,
|
||||
std::unique_ptr<AudioOutput> audio_output,
|
||||
// RingRTC change to allow control of AEC3 vs AEC3
|
||||
bool use_aecm)
|
||||
std::unique_ptr<AudioOutput> audio_output)
|
||||
: audio_layer_(audio_layer),
|
||||
is_stereo_playout_supported_(is_stereo_playout_supported),
|
||||
is_stereo_record_supported_(is_stereo_record_supported),
|
||||
|
@ -69,7 +67,6 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||
task_queue_factory_(CreateDefaultTaskQueueFactory()),
|
||||
input_(std::move(audio_input)),
|
||||
output_(std::move(audio_output)),
|
||||
use_aecm_(use_aecm),
|
||||
initialized_(false) {
|
||||
RTC_CHECK(input_);
|
||||
RTC_CHECK(output_);
|
||||
|
@ -545,13 +542,6 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||
return isAvailable;
|
||||
}
|
||||
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
bool UseAecm() const override {
|
||||
RTC_DLOG(LS_INFO) << __FUNCTION__;
|
||||
RTC_DLOG(LS_INFO) << "output: " << use_aecm_;
|
||||
return use_aecm_;
|
||||
}
|
||||
|
||||
// TODO(henrika): add implementation for OpenSL ES based audio as well.
|
||||
int32_t EnableBuiltInAEC(bool enable) override {
|
||||
RTC_DLOG(LS_INFO) << __FUNCTION__ << "(" << enable << ")";
|
||||
|
@ -609,7 +599,6 @@ class AndroidAudioDeviceModule : public AudioDeviceModule {
|
|||
const std::unique_ptr<AudioInput> input_;
|
||||
const std::unique_ptr<AudioOutput> output_;
|
||||
std::unique_ptr<AudioDeviceBuffer> audio_device_buffer_;
|
||||
const bool use_aecm_ = false;
|
||||
|
||||
bool initialized_;
|
||||
};
|
||||
|
@ -664,13 +653,11 @@ rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceModuleFromInputAndOutput(
|
|||
bool is_stereo_record_supported,
|
||||
uint16_t playout_delay_ms,
|
||||
std::unique_ptr<AudioInput> audio_input,
|
||||
std::unique_ptr<AudioOutput> audio_output,
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
bool use_aecm) {
|
||||
std::unique_ptr<AudioOutput> audio_output) {
|
||||
RTC_DLOG(LS_INFO) << __FUNCTION__;
|
||||
return rtc::make_ref_counted<AndroidAudioDeviceModule>(
|
||||
audio_layer, is_stereo_playout_supported, is_stereo_record_supported,
|
||||
playout_delay_ms, std::move(audio_input), std::move(audio_output), use_aecm);
|
||||
playout_delay_ms, std::move(audio_input), std::move(audio_output));
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
|
|
|
@ -100,9 +100,7 @@ rtc::scoped_refptr<AudioDeviceModule> CreateAudioDeviceModuleFromInputAndOutput(
|
|||
bool is_stereo_record_supported,
|
||||
uint16_t playout_delay_ms,
|
||||
std::unique_ptr<AudioInput> audio_input,
|
||||
std::unique_ptr<AudioOutput> audio_output,
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
bool use_aecm);
|
||||
std::unique_ptr<AudioOutput> audio_output);
|
||||
|
||||
} // namespace jni
|
||||
|
||||
|
|
|
@ -27,9 +27,7 @@ static jlong JNI_JavaAudioDeviceModule_CreateAudioDeviceModule(
|
|||
int input_sample_rate,
|
||||
int output_sample_rate,
|
||||
jboolean j_use_stereo_input,
|
||||
jboolean j_use_stereo_output,
|
||||
// RingRTC change to allow control of AEC3 vs AECM
|
||||
jboolean j_use_aecm) {
|
||||
jboolean j_use_stereo_output) {
|
||||
AudioParameters input_parameters;
|
||||
AudioParameters output_parameters;
|
||||
GetAudioParameters(env, j_context, j_audio_manager, input_sample_rate,
|
||||
|
@ -45,8 +43,7 @@ static jlong JNI_JavaAudioDeviceModule_CreateAudioDeviceModule(
|
|||
AudioDeviceModule::kAndroidJavaAudio,
|
||||
j_use_stereo_input, j_use_stereo_output,
|
||||
kHighLatencyModeDelayEstimateInMilliseconds,
|
||||
std::move(audio_input), std::move(audio_output),
|
||||
j_use_aecm)
|
||||
std::move(audio_input), std::move(audio_output))
|
||||
.release());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue