Add one frame (10 ms) of silence in APM output after unmuting
This CL adds one frame (10 ms) of silence in APM output after unmuting to mask audio resulting from the turning on the processing that was deactivated during the muting. Bug: b/177830919 Change-Id: If44cfb0ef270dde839dcd3f0b98d1c91e81668dd Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/211343 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Per Åhgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33454}
This commit is contained in:
parent
1e60490ddb
commit
55bc077b45
@ -1325,6 +1325,20 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
|
||||
// Pass stats for reporting.
|
||||
stats_reporter_.UpdateStatistics(capture_.stats);
|
||||
|
||||
// Temporarily set the output to zero after the stream has been unmuted
|
||||
// (capture output is again used). The purpose of this is to avoid clicks and
|
||||
// artefacts in the audio that results when the processing again is
|
||||
// reactivated after unmuting.
|
||||
if (!capture_.capture_output_used_last_frame &&
|
||||
capture_.capture_output_used) {
|
||||
for (size_t ch = 0; ch < capture_buffer->num_channels(); ++ch) {
|
||||
rtc::ArrayView<float> channel_view(capture_buffer->channels()[ch],
|
||||
capture_buffer->num_frames());
|
||||
std::fill(channel_view.begin(), channel_view.end(), 0.f);
|
||||
}
|
||||
}
|
||||
capture_.capture_output_used_last_frame = capture_.capture_output_used;
|
||||
|
||||
capture_.was_stream_delay_set = false;
|
||||
return kNoError;
|
||||
}
|
||||
@ -2025,6 +2039,7 @@ void AudioProcessingImpl::RecordAudioProcessingState() {
|
||||
AudioProcessingImpl::ApmCaptureState::ApmCaptureState()
|
||||
: was_stream_delay_set(false),
|
||||
capture_output_used(true),
|
||||
capture_output_used_last_frame(true),
|
||||
key_pressed(false),
|
||||
capture_processing_format(kSampleRate16kHz),
|
||||
split_rate(kSampleRate16kHz),
|
||||
|
||||
@ -433,6 +433,7 @@ class AudioProcessingImpl : public AudioProcessing {
|
||||
~ApmCaptureState();
|
||||
bool was_stream_delay_set;
|
||||
bool capture_output_used;
|
||||
bool capture_output_used_last_frame;
|
||||
bool key_pressed;
|
||||
std::unique_ptr<AudioBuffer> capture_audio;
|
||||
std::unique_ptr<AudioBuffer> capture_fullband_audio;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user