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

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: Comments. 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..7f371155210f4bbbfc9d57256bf9a3bf1fd13d8f 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -194,7 +194,6 @@ void AudioOutputDevice::OnStreamCreated(
base::SyncSocket::Handle socket_handle,
int length) {
DCHECK(message_loop()->BelongsToCurrentThread());
- DCHECK_GE(length, audio_parameters_.GetBytesPerBuffer());
#if defined(OS_WIN)
DCHECK(handle);
DCHECK(socket_handle);
@@ -266,20 +265,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().
Chris Rogers 2012/08/28 22:32:05 With any luck, we'll be able to get rid of the nee
DaleCurtis 2012/08/29 04:34:43 Done.
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