Chromium Code Reviews| Index: media/audio/audio_output_device.cc |
| diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc |
| index 0dcc76aca062b19bbdfb941088d053c1d1970ad3..b925d84fb4b941bff97d7a17bf7325214112c2fe 100644 |
| --- a/media/audio/audio_output_device.cc |
| +++ b/media/audio/audio_output_device.cc |
| @@ -24,6 +24,8 @@ |
| namespace media { |
| +static const int kMaxFramesPerCompressedAudioBuffer = 4096; |
|
DaleCurtis
2016/11/01 23:05:13
This needs to be a property of the AudioParameters
AndyWu
2016/11/04 18:04:24
Done, thanks for your help.
|
| + |
| // Takes care of invoking the render callback on the audio thread. |
| // An instance of this class is created for each capture stream in |
| // OnStreamCreated(). |
| @@ -476,12 +478,22 @@ void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data) { |
| << " frames_delayed(pre-round):" << frames_delayed |
| << " frames_skipped:" << frames_skipped; |
| + output_bus_->set_is_raw_format(audio_parameters_.IsRawFormat()); |
| + if (audio_parameters_.IsRawFormat()) { |
| + // Reset the data size and frame count. |
| + // For compressed audio formats, the data size and frame count will be |
| + // updated by |render_callback_|. |
| + output_bus_->set_data_size(0); |
| + output_bus_->set_frames(kMaxFramesPerCompressedAudioBuffer); |
| + } |
| // Update the audio-delay measurement, inform about the number of skipped |
| // frames, and ask client to render audio. Since |output_bus_| is wrapping |
| // the shared memory the Render() call is writing directly into the shared |
| // memory. |
| render_callback_->Render(output_bus_.get(), std::round(frames_delayed), |
| frames_skipped); |
| + buffer->params.frames = output_bus_->frames(); |
| + buffer->params.data_size = output_bus_->data_size(); |
| } |
| bool AudioOutputDevice::AudioThreadCallback:: |