| Index: media/audio/audio_output_device.cc
|
| diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
|
| index 9924f76b83e5e4e435a6f0a5598a22a68acad809..a0c6d4987093988f2973ee1f904a8277c335cc27 100644
|
| --- a/media/audio/audio_output_device.cc
|
| +++ b/media/audio/audio_output_device.cc
|
| @@ -28,12 +28,17 @@ class AudioOutputDevice::AudioThreadCallback
|
| void MapSharedMemory() override;
|
|
|
| // Called whenever we receive notifications about pending data.
|
| - void Process(uint32 pending_data) override;
|
| + void Process(uint32_t pending_data, uint32_t frames_skipped) override;
|
|
|
| private:
|
| AudioRendererSink::RenderCallback* render_callback_;
|
| scoped_ptr<AudioBus> output_bus_;
|
| uint64 callback_num_;
|
| +
|
| + // Stores the number of frames skipped by the consumer. Increased in
|
| + // FramesSkipped(). Used and cleared in Process().
|
| + uint32_t frames_skipped_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(AudioThreadCallback);
|
| };
|
|
|
| @@ -354,7 +359,7 @@ void AudioOutputDevice::OnStreamCreated(
|
| audio_callback_.reset(new AudioOutputDevice::AudioThreadCallback(
|
| audio_parameters_, handle, length, callback_));
|
| audio_thread_.Start(audio_callback_.get(), socket_handle,
|
| - "AudioOutputDevice", true);
|
| + "AudioOutputDevice", true, false);
|
| state_ = PAUSED;
|
|
|
| // We handle the case where Play() and/or Pause() may have been called
|
| @@ -387,7 +392,8 @@ AudioOutputDevice::AudioThreadCallback::AudioThreadCallback(
|
| AudioRendererSink::RenderCallback* render_callback)
|
| : AudioDeviceThread::Callback(audio_parameters, memory, memory_length, 1),
|
| render_callback_(render_callback),
|
| - callback_num_(0) {}
|
| + callback_num_(0),
|
| + frames_skipped_(0) {}
|
|
|
| AudioOutputDevice::AudioThreadCallback::~AudioThreadCallback() {
|
| }
|
| @@ -402,7 +408,8 @@ void AudioOutputDevice::AudioThreadCallback::MapSharedMemory() {
|
| }
|
|
|
| // Called whenever we receive notifications about pending data.
|
| -void AudioOutputDevice::AudioThreadCallback::Process(uint32 pending_data) {
|
| +void AudioOutputDevice::AudioThreadCallback::Process(uint32_t pending_data,
|
| + uint32_t frames_skipped) {
|
| // Convert the number of pending bytes in the render buffer into milliseconds.
|
| int audio_delay_milliseconds = pending_data / bytes_per_ms_;
|
|
|
| @@ -417,10 +424,12 @@ void AudioOutputDevice::AudioThreadCallback::Process(uint32 pending_data) {
|
| TRACE_EVENT_ASYNC_END0("audio", "StartingPlayback", this);
|
| }
|
|
|
| - // Update the audio-delay measurement then 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(), audio_delay_milliseconds);
|
| + // 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(), audio_delay_milliseconds,
|
| + frames_skipped);
|
| }
|
|
|
| -} // namespace media.
|
| +} // namespace media
|
|
|