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

Unified Diff: media/audio/win/audio_unified_win.cc

Issue 17377004: Resolves crash in media::ChannelMixer::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/win/audio_unified_win.cc
diff --git a/media/audio/win/audio_unified_win.cc b/media/audio/win/audio_unified_win.cc
index 20fa1333df71c4b6df2e8d7306a37008b48d90bf..a2f2c36fb81bdd34029775cf1570fe4acba1e95e 100644
--- a/media/audio/win/audio_unified_win.cc
+++ b/media/audio/win/audio_unified_win.cc
@@ -280,7 +280,11 @@ bool WASAPIUnifiedStream::Open() {
// One extra bus is needed for the input channel mixing case.
if (channel_mixer_) {
DCHECK_LT(hw_input_params.channels(), input_channels_);
- channel_bus_ = AudioBus::Create(input_channels_, input_bus_->frames());
+ // The size of the |channel_bus_| must be the same as the size of the
+ // output bus to ensure that the channel manager can deal with both
+ // resampled and non-resampled data as input.
+ channel_bus_ = AudioBus::Create(
+ input_channels_, params_.frames_per_buffer());
}
// Check if FIFO and resampling is required to match the input rate to the
@@ -912,6 +916,7 @@ void WASAPIUnifiedStream::ProcessOutputAudio(IAudioClock* audio_output_clock) {
AudioBus* input_bus = VarispeedMode() ?
resampled_bus_.get() : input_bus_.get();
if (channel_mixer_) {
+ DCHECK_EQ(input_bus->frames(), channel_bus_->frames());
// Most common case is 1->2 channel upmixing.
channel_mixer_->Transform(input_bus, channel_bus_.get());
// Use the output from the channel mixer as new input bus.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698