NetEq: Fix bug in PLC for multi-channel audio

There is currently a bug in NetEq that causes audio to leak from the
first channel to all others during loss concealment. This CL fixes the
problem and also adds a unit test to verify.

Bug: webrtc:11145
Change-Id: Ia6c4a234ff7f78e9a6080f1cb17eb80af671c3dc
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/161091
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29974}
This commit is contained in:
Henrik Lundin
2019-12-02 15:46:00 +01:00
committed by Commit Bot
parent 5256d8bc4b
commit 21021f022b
2 changed files with 47 additions and 2 deletions

View File

@ -469,6 +469,14 @@ void Expand::AnalyzeSignal(int16_t* random_vector) {
for (size_t channel_ix = 0; channel_ix < num_channels_; ++channel_ix) {
ChannelParameters& parameters = channel_parameters_[channel_ix];
if (channel_ix > 0) {
// When channel_ix == 0, audio_history contains the correct audio. For the
// other cases, we will have to copy the correct channel into
// audio_history.
(*sync_buffer_)[channel_ix].CopyTo(signal_length, audio_history_position,
audio_history.get());
}
// Calculate suitable scaling.
int16_t signal_max = WebRtcSpl_MaxAbsValueW16(
&audio_history[signal_length - correlation_length - start_index -