Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: webrtc/modules/audio_processing/audio_buffer.cc

Issue 1234463003: Integrate Intelligibility with APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated interface, how VAD is used, other issues Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/audio_buffer.cc
diff --git a/webrtc/modules/audio_processing/audio_buffer.cc b/webrtc/modules/audio_processing/audio_buffer.cc
index 04dcaea799d60af6bbc48d899e9ded8134d6ce03..144a33333e03958c63eb9b75b0c11f6756654beb 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -436,20 +436,27 @@ void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
}
void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
+ if (!data_changed) {
+ return;
+ }
+
assert(proc_num_frames_ == output_num_frames_);
- assert(num_channels_ == num_input_channels_);
- assert(frame->num_channels_ == num_channels_);
+ assert(frame->num_channels_ == num_channels_ || num_channels_ == 1);
assert(frame->samples_per_channel_ == proc_num_frames_);
frame->vad_activity_ = activity_;
- if (!data_changed) {
- return;
+ if (frame->num_channels_ == num_channels_) {
+ Interleave(data_->ibuf()->channels(), proc_num_frames_, num_channels_,
+ frame->data_);
+ } else {
+ // Copy single AudioBuffer channel into all AudioFrame channels
+ int16_t* const* channel_ptr_copies[frame->num_channels_];
aluebs-webrtc 2015/07/20 19:33:43 int16_t* channel_ptr_copies[frame->num_channels_];
ekm 2015/07/21 01:02:43 Done.
+ for (int i = 0; i < frame->num_channels_; i++) {
aluebs-webrtc 2015/07/20 19:33:43 ++i
ekm 2015/07/21 01:02:43 Done.
+ channel_ptr_copies[i] = data_->ibuf()->channels();
aluebs-webrtc 2015/07/20 19:33:43 data->ibuf()->channels()[0];
ekm 2015/07/21 01:02:43 Done.
+ }
+ Interleave(data_->ibuf()->channels(), proc_num_frames_, num_channels_,
aluebs-webrtc 2015/07/20 19:33:43 channel_ptr_copies
ekm 2015/07/21 01:02:43 Done. Phew, nice catch.
+ frame->data_);
}
-
- Interleave(data_->ibuf()->channels(),
- proc_num_frames_,
- num_channels_,
- frame->data_);
}
void AudioBuffer::CopyLowPassToReference() {

Powered by Google App Engine
This is Rietveld 408576698