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

Unified Diff: media/audio/audio_output_device.cc

Issue 10832285: Switch OnMoreData() to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review ready. Created 8 years, 4 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: media/audio/audio_output_device.cc
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index 34ff54eb7078224293f70c7e107dafcbcd7e329f..7e90f008ba004cbea0d58b307497b33a5b1cb089 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -266,20 +266,20 @@ void AudioOutputDevice::AudioThreadCallback::Process(int pending_data) {
TRACE_EVENT0("audio", "AudioOutputDevice::FireRenderCallback");
- // Update the audio-delay measurement then ask client to render audio.
+ // Update the audio-delay measurement then ask client to render audio. Since
+ // |audio_bus_| is wrapping the shared memory the Render() call is writing
+ // directly into the shared memory.
size_t num_frames = render_callback_->Render(
audio_bus_.get(), audio_delay_milliseconds);
- // Interleave, scale, and clip to int.
- // TODO(dalecurtis): Remove this when we have float everywhere:
- // http://crbug.com/114700
- audio_bus_->ToInterleaved(num_frames, audio_parameters_.bits_per_sample() / 8,
- shared_memory_.memory());
-
// Let the host know we are done.
+ // TODO(dalecurtis): Technically this is not always correct. Due to channel
+ // padding for alignment, there may be more data available than this. We're
+ // relying on AudioSyncReader::Read() to parse this with that in mind. Rename
+ // these methods to Set/GetActualFrameCount().
SetActualDataSizeInBytes(
&shared_memory_, memory_length_,
- num_frames * audio_parameters_.GetBytesPerFrame());
+ num_frames * sizeof(*audio_bus_->channel(0)) * audio_bus_->channels());
}
} // namespace media.

Powered by Google App Engine
This is Rietveld 408576698