Fix incorrect memset on muted frames.
Broken by https://codereview.webrtc.org/2750783004/. Since samples are two bytes each, only half of the buffer was being zeroed, leading to garbage noise. BUG=webrtc:7885,webrtc:7343 Change-Id: I46ecf90258b681ccdebbcfadd2e84ac6abadc9fe Reviewed-on: https://chromium-review.googlesource.com/593092 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Jonathan Yu <yujo@chromium.org> Cr-Commit-Position: refs/heads/master@{#19194}
This commit is contained in:
parent
ae1532a214
commit
36344a0c9b
@ -10,6 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
|
||||
#include "webrtc/modules/audio_coding/acm2/acm_receiver.h"
|
||||
#include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
|
||||
@ -335,7 +337,7 @@ int DownMix(const AudioFrame& frame,
|
||||
static_cast<int32_t>(frame_data[2 * n + 1])) >> 1);
|
||||
}
|
||||
} else {
|
||||
memset(out_buff, 0, frame.samples_per_channel_);
|
||||
std::fill(out_buff, out_buff + frame.samples_per_channel_, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -354,7 +356,7 @@ int UpMix(const AudioFrame& frame, size_t length_out_buff, int16_t* out_buff) {
|
||||
out_buff[2 * i] = sample;
|
||||
}
|
||||
} else {
|
||||
memset(out_buff, 0, 2 * frame.samples_per_channel_);
|
||||
std::fill(out_buff, out_buff + frame.samples_per_channel_ * 2, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user