[ResamplerHelper] Avoid resampling muted audio frames.
Bug: none
Change-Id: I1787b5ea6b9b33a0d37992287a4adc287fbb2ce5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/392662
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44729}
diff --git a/modules/audio_coding/acm2/acm_resampler.cc b/modules/audio_coding/acm2/acm_resampler.cc
index 9daa04d..7d42d8f 100644
--- a/modules/audio_coding/acm2/acm_resampler.cc
+++ b/modules/audio_coding/acm2/acm_resampler.cc
@@ -58,8 +58,10 @@
audio_frame->SetSampleRateAndChannelSize(desired_sample_rate_hz);
InterleavedView<int16_t> dst = audio_frame->mutable_data(
audio_frame->samples_per_channel(), audio_frame->num_channels());
- // TODO(tommi): Don't resample muted audio frames.
- resampler_.Resample(src, dst);
+ // Muted frames will already have the audio buffer zeroed out.
+ if (!audio_frame->muted()) {
+ resampler_.Resample(src, dst);
+ }
resampled_last_output_frame_ = true;
} else {
resampled_last_output_frame_ = false;