| Index: media/audio/mac/audio_output_mac.cc
|
| diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc
|
| index 7f96735a495d6771b1e027740129cb7dcc95806a..0a0c321d33371bf2e076c497635088db8b9fe46c 100644
|
| --- a/media/audio/mac/audio_output_mac.cc
|
| +++ b/media/audio/mac/audio_output_mac.cc
|
| @@ -53,7 +53,8 @@ PCMQueueOutAudioOutputStream::PCMQueueOutAudioOutputStream(
|
| should_swizzle_(false),
|
| should_down_mix_(false),
|
| stopped_event_(true /* manual reset */, false /* initial state */),
|
| - num_buffers_left_(kNumBuffers) {
|
| + num_buffers_left_(kNumBuffers),
|
| + audio_bus_(AudioBus::Create(params)) {
|
| // We must have a manager.
|
| DCHECK(manager_);
|
| // A frame is one sample across all channels. In interleaved audio the per
|
| @@ -409,11 +410,20 @@ void PCMQueueOutAudioOutputStream::RenderCallback(void* p_this,
|
| // Adjust the number of pending bytes by subtracting the amount played.
|
| if (!static_cast<AudioQueueUserData*>(buffer->mUserData)->empty_buffer)
|
| audio_stream->pending_bytes_ -= buffer->mAudioDataByteSize;
|
| +
|
| uint32 capacity = buffer->mAudioDataBytesCapacity;
|
| + AudioBus* audio_bus = audio_stream->audio_bus_.get();
|
| + DCHECK_EQ(
|
| + audio_bus->frames() * audio_stream->format_.mBytesPerFrame, capacity);
|
| // TODO(sergeyu): Specify correct hardware delay for AudioBuffersState.
|
| - uint32 filled = source->OnMoreData(
|
| - reinterpret_cast<uint8*>(buffer->mAudioData), capacity,
|
| - AudioBuffersState(audio_stream->pending_bytes_, 0));
|
| + int frames_filled = source->OnMoreData(
|
| + audio_bus, AudioBuffersState(audio_stream->pending_bytes_, 0));
|
| + uint32 filled = frames_filled * audio_stream->format_.mBytesPerFrame;
|
| + // 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, audio_stream->format_.mBitsPerChannel / 8,
|
| + buffer->mAudioData);
|
|
|
| // In order to keep the callback running, we need to provide a positive amount
|
| // of data to the audio queue. To simulate the behavior of Windows, we write
|
|
|