| Index: media/audio/pulse/pulse_output.cc
|
| diff --git a/media/audio/pulse/pulse_output.cc b/media/audio/pulse/pulse_output.cc
|
| index f86860571a03fca4390c4149704888b5c3630d55..5efa040c0d1b96a712a77cc309badbeef9db4f2a 100644
|
| --- a/media/audio/pulse/pulse_output.cc
|
| +++ b/media/audio/pulse/pulse_output.cc
|
| @@ -12,6 +12,7 @@
|
| #include "media/audio/audio_device_description.h"
|
| #include "media/audio/audio_manager_base.h"
|
| #include "media/audio/pulse/pulse_util.h"
|
| +#include "media/base/audio_sample_types.h"
|
|
|
| namespace media {
|
|
|
| @@ -43,7 +44,14 @@ void PulseAudioOutputStream::StreamRequestCallback(pa_stream* s, size_t len,
|
| PulseAudioOutputStream::PulseAudioOutputStream(const AudioParameters& params,
|
| const std::string& device_id,
|
| AudioManagerBase* manager)
|
| - : params_(params),
|
| + : params_(AudioParameters(params.format(),
|
| + params.channel_layout(),
|
| + params.sample_rate(),
|
| + // Ignore the given bits per sample. We
|
| + // want 32 because we're outputting
|
| + // floats.
|
| + 32,
|
| + params.frames_per_buffer())),
|
| device_id_(device_id),
|
| manager_(manager),
|
| pa_context_(NULL),
|
| @@ -143,11 +151,9 @@ void PulseAudioOutputStream::FulfillWriteRequest(size_t requested_bytes) {
|
| frames_filled, audio_bus_->frames() - frames_filled);
|
| }
|
|
|
| - // 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_->Scale(volume_);
|
| - audio_bus_->ToInterleaved(
|
| - audio_bus_->frames(), params_.bits_per_sample() / 8, buffer);
|
| + audio_bus_->ToInterleaved<Float32SampleTypeTraits>(
|
| + audio_bus_->frames(), reinterpret_cast<float*>(buffer));
|
| } else {
|
| memset(buffer, 0, bytes_to_fill);
|
| }
|
|
|