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

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: Fixed memcpy 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..cc8375e449b1e300b96d616c7d6cd782e4e618e8 100644
--- a/webrtc/modules/audio_processing/audio_buffer.cc
+++ b/webrtc/modules/audio_processing/audio_buffer.cc
@@ -436,20 +436,28 @@ void AudioBuffer::DeinterleaveFrom(AudioFrame* frame) {
}
void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
- assert(proc_num_frames_ == output_num_frames_);
- assert(num_channels_ == num_input_channels_);
- assert(frame->num_channels_ == num_channels_);
- assert(frame->samples_per_channel_ == proc_num_frames_);
frame->vad_activity_ = activity_;
-
if (!data_changed) {
return;
}
- Interleave(data_->ibuf()->channels(),
- proc_num_frames_,
- num_channels_,
- frame->data_);
+ assert(proc_num_frames_ == output_num_frames_);
+ assert(frame->num_channels_ == num_channels_ || num_channels_ == 1);
+ assert(frame->samples_per_channel_ == proc_num_frames_);
+
+ 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
Andrew MacDonald 2015/07/24 23:50:39 Period at the end, and can you note that this is s
ekm 2015/07/29 00:37:19 Done.
+ rtc::scoped_ptr<int16_t*> channel_ptr_copies(
+ new int16_t*[frame->num_channels_]);
Andrew MacDonald 2015/07/24 23:50:39 Arg, why did you switch to using dynamic allocatio
ekm 2015/07/29 00:37:19 Done.
+ for (int i = 0; i < frame->num_channels_; ++i) {
+ channel_ptr_copies.get()[i] = data_->ibuf()->channels()[0];
+ }
+ Interleave(channel_ptr_copies.get(), proc_num_frames_, num_channels_,
+ frame->data_);
+ }
}
void AudioBuffer::CopyLowPassToReference() {

Powered by Google App Engine
This is Rietveld 408576698