| Index: media/audio/mac/audio_low_latency_output_mac.cc
|
| diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc
|
| index d9127f8d2824b1c7040d10d71c8c83d10b49fb49..b9248dc25467ed52249340cda87c79d40240151f 100644
|
| --- a/media/audio/mac/audio_low_latency_output_mac.cc
|
| +++ b/media/audio/mac/audio_low_latency_output_mac.cc
|
| @@ -53,7 +53,8 @@ AUAudioOutputStream::AUAudioOutputStream(
|
| output_device_id_(kAudioObjectUnknown),
|
| volume_(1),
|
| hardware_latency_frames_(0),
|
| - stopped_(false) {
|
| + stopped_(false),
|
| + 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
|
| @@ -226,11 +227,19 @@ OSStatus AUAudioOutputStream::Render(UInt32 number_of_frames,
|
| uint8* audio_data = reinterpret_cast<uint8*>(buffer.mData);
|
| uint32 hardware_pending_bytes = static_cast<uint32>
|
| ((playout_latency_frames + 0.5) * format_.mBytesPerFrame);
|
| - uint32 filled = source_->OnMoreData(
|
| - audio_data, buffer.mDataByteSize,
|
| - AudioBuffersState(0, hardware_pending_bytes));
|
| +
|
| + DCHECK_EQ(number_of_frames, static_cast<UInt32>(audio_bus_->frames()));
|
| + int frames_filled = source_->OnMoreData(
|
| + audio_bus_.get(), AudioBuffersState(0, hardware_pending_bytes));
|
| + // 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, format_.mBitsPerChannel / 8, audio_data);
|
| + uint32 filled = frames_filled * format_.mBytesPerFrame;
|
|
|
| // Handle channel order for 5.1 audio.
|
| + // TODO(dalecurtis): Channel downmixing, upmixing, should be done in mixer;
|
| + // volume adjust should use SSE optimized vector_fmul() prior to interleave.
|
| if (format_.mChannelsPerFrame == 6) {
|
| if (format_.mBitsPerChannel == 8) {
|
| SwizzleCoreAudioLayout5_1(reinterpret_cast<uint8*>(audio_data), filled);
|
|
|