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

Unified Diff: webrtc/common_audio/channel_buffer.cc

Issue 2053773002: Keep track of the user-facing number of channels in a ChannelBuffer (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Add unittests Created 4 years, 6 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/common_audio/channel_buffer.cc
diff --git a/webrtc/common_audio/channel_buffer.cc b/webrtc/common_audio/channel_buffer.cc
index 349d4245ccdb6e472db3cb60ee3a951c1e333b3b..b69491daa2d5b0f1cc907f75183a9b5be286381d 100644
--- a/webrtc/common_audio/channel_buffer.cc
+++ b/webrtc/common_audio/channel_buffer.cc
@@ -54,6 +54,7 @@ void IFChannelBuffer::RefreshF() const {
float_channels[i][j] = int_channels[i][j];
}
}
+ fbuf_.set_num_channels(ibuf_.num_channels());
peah-webrtc 2016/06/23 13:32:21 Would it be possible to move this before the copy?
aluebs-webrtc 2016/06/24 02:49:16 Good point, although it should never happen. Done.
fvalid_ = true;
}
}
@@ -63,11 +64,12 @@ void IFChannelBuffer::RefreshI() const {
RTC_DCHECK(fvalid_);
int16_t* const* int_channels = ibuf_.channels();
const float* const* float_channels = fbuf_.channels();
- for (size_t i = 0; i < ibuf_.num_channels(); ++i) {
+ for (size_t i = 0; i < fbuf_.num_channels(); ++i) {
FloatS16ToS16(float_channels[i],
ibuf_.num_frames(),
int_channels[i]);
}
+ ibuf_.set_num_channels(fbuf_.num_channels());
peah-webrtc 2016/06/23 13:32:21 Would it be possible to move this before the copy?
aluebs-webrtc 2016/06/24 02:49:16 Good point, although it should never happen. Done.
ivalid_ = true;
}
}

Powered by Google App Engine
This is Rietveld 408576698