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

Unified Diff: media/audio/pulse/pulse_output.cc

Issue 10832285: Switch OnMoreData() to use AudioBus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Comments. Created 8 years, 3 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 | « media/audio/pulse/pulse_output.h ('k') | media/audio/simple_sources.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/pulse/pulse_output.cc
diff --git a/media/audio/pulse/pulse_output.cc b/media/audio/pulse/pulse_output.cc
index 98f1f58391cd3faf615da999affe4d29a56876c8..bdd29c00c6a5c6455e8a6bf1f49c47daacf99a86 100644
--- a/media/audio/pulse/pulse_output.cc
+++ b/media/audio/pulse/pulse_output.cc
@@ -310,10 +310,16 @@ bool PulseAudioOutputStream::BufferPacketFromSource() {
// to happen in practice though.
scoped_refptr<media::DataBuffer> packet =
new media::DataBuffer(packet_size_);
- size_t packet_size = RunDataCallback(packet->GetWritableData(),
- packet->GetBufferSize(),
- AudioBuffersState(buffer_delay,
- hardware_delay));
+ int frames_filled = RunDataCallback(
+ audio_bus_.get(), AudioBuffersState(buffer_delay, hardware_delay));
+ size_t packet_size = frames_filled * bytes_per_frame_;
+
+ DCHECK_LE(packet_size, packet_size_);
+ // Note: If this ever changes to output raw float the data must be clipped and
+ // sanitized since it may come from an untrusted source such as NaCl.
+ audio_bus_->ToInterleaved(
+ frames_filled, bytes_per_frame_ / channel_count_,
+ packet->GetWritableData());
if (packet_size == 0)
return false;
@@ -421,10 +427,10 @@ void PulseAudioOutputStream::GetVolume(double* volume) {
*volume = volume_;
}
-uint32 PulseAudioOutputStream::RunDataCallback(
- uint8* dest, uint32 max_size, AudioBuffersState buffers_state) {
+int PulseAudioOutputStream::RunDataCallback(
+ AudioBus* audio_bus, AudioBuffersState buffers_state) {
if (source_callback_)
- return source_callback_->OnMoreData(dest, max_size, buffers_state);
+ return source_callback_->OnMoreData(audio_bus, buffers_state);
return 0;
}
« no previous file with comments | « media/audio/pulse/pulse_output.h ('k') | media/audio/simple_sources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698