Reinitialize mono push resampler PushResampler's interleaved Resample path reinitializes when sample counts or channel count change, but the mono overload skipped that step. Call EnsureInitialized from the mono overload as well so changes in source or destination samples per channel recreate the resampler before use. Bug: webrtc:514442562 Change-Id: I73a586b8fc83e07190f318c82a1374dd60159e21 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/473560 Reviewed-by: Per Ã…hgren <peah@webrtc.org> Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Boris Tsirkin <btsirkin@meta.com> Cr-Commit-Position: refs/heads/main@{#47746}
diff --git a/common_audio/resampler/push_resampler.cc b/common_audio/resampler/push_resampler.cc index 14ec109..f424a9a 100644 --- a/common_audio/resampler/push_resampler.cc +++ b/common_audio/resampler/push_resampler.cc
@@ -106,6 +106,8 @@ template <typename T> void PushResampler<T>::Resample(MonoView<const T> src, MonoView<T> dst) { + EnsureInitialized(SamplesPerChannel(src), SamplesPerChannel(dst), 1); + RTC_DCHECK_EQ(resamplers_.size(), 1); RTC_DCHECK_EQ(SamplesPerChannel(src), SamplesPerChannel(source_view_)); RTC_DCHECK_EQ(SamplesPerChannel(dst), SamplesPerChannel(destination_view_));