Added an API to disable VolumeLogger on Android.

Change-Id: Ib16c9e02fe18e1d6628f2192a21c53515753bcde
Bug: webrtc:14321
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270621
Reviewed-by: Xavier Lepaul‎ <xalep@webrtc.org>
Commit-Queue: Xavier Lepaul‎ <xalep@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37693}
This commit is contained in:
Ranveer Aggarwal
2022-08-04 16:20:56 +00:00
committed by WebRTC LUCI CQ
parent 5bb566cf1e
commit a0e090ff5a
2 changed files with 21 additions and 7 deletions

View File

@ -50,6 +50,7 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
private boolean useStereoOutput;
private AudioAttributes audioAttributes;
private boolean useLowLatency;
private boolean enableVolumeLogger;
private Builder(Context context) {
this.context = context;
@ -57,6 +58,7 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
this.inputSampleRate = WebRtcAudioManager.getSampleRate(audioManager);
this.outputSampleRate = WebRtcAudioManager.getSampleRate(audioManager);
this.useLowLatency = false;
this.enableVolumeLogger = true;
}
public Builder setScheduler(ScheduledExecutorService scheduler) {
@ -213,6 +215,12 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
return this;
}
/** Disables the volume logger on the audio output track. */
public Builder setEnableVolumeLogger(boolean enableVolumeLogger) {
this.enableVolumeLogger = enableVolumeLogger;
return this;
}
/**
* Construct an AudioDeviceModule based on the supplied arguments. The caller takes ownership
* and is responsible for calling release().
@ -248,8 +256,9 @@ public class JavaAudioDeviceModule implements AudioDeviceModule {
final WebRtcAudioRecord audioInput = new WebRtcAudioRecord(context, executor, audioManager,
audioSource, audioFormat, audioRecordErrorCallback, audioRecordStateCallback,
samplesReadyCallback, useHardwareAcousticEchoCanceler, useHardwareNoiseSuppressor);
final WebRtcAudioTrack audioOutput = new WebRtcAudioTrack(context, audioManager,
audioAttributes, audioTrackErrorCallback, audioTrackStateCallback, useLowLatency);
final WebRtcAudioTrack audioOutput =
new WebRtcAudioTrack(context, audioManager, audioAttributes, audioTrackErrorCallback,
audioTrackStateCallback, useLowLatency, enableVolumeLogger);
return new JavaAudioDeviceModule(context, audioManager, audioInput, audioOutput,
inputSampleRate, outputSampleRate, useStereoInput, useStereoOutput);
}