diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 01:59:55 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-29 01:59:55 +0000 |
commit | 97fce46c1ad6c8b4afa53e513c758bc0bd8bfc60 (patch) | |
tree | e3b4bba7e7257147a8a9eb112ab8f2a98620766c /media | |
parent | 905ef37a0740434886d17e5edca74529bdf36cc6 (diff) | |
download | chromium_src-97fce46c1ad6c8b4afa53e513c758bc0bd8bfc60.zip chromium_src-97fce46c1ad6c8b4afa53e513c758bc0bd8bfc60.tar.gz chromium_src-97fce46c1ad6c8b4afa53e513c758bc0bd8bfc60.tar.bz2 |
Fixes an audio playback regression caused by seeking in audio/video media.
This is a temporary fix to a much larger problem of dealing with Chrome's audio IPC layer. Since a seek is a small amount of time, we keep the audio IPC conversation going by writing 8k of zeros. Before we were telling the audio IPC layer that we were out of data, which technically was a lie (we were just seeking), and as a result the conversation died at that point.
TEST=seek around in a video, audio should keep playing and remain in sync
BUG=17917
Review URL: http://codereview.chromium.org/160283
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/audio_renderer_base.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/media/filters/audio_renderer_base.cc b/media/filters/audio_renderer_base.cc index 5726bb1..9d6a2bd 100644 --- a/media/filters/audio_renderer_base.cc +++ b/media/filters/audio_renderer_base.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <algorithm> + #include "media/base/filter_host.h" #include "media/filters/audio_renderer_base.h" @@ -144,7 +146,14 @@ size_t AudioRendererBase::FillBuffer(uint8* dest, // Mute audio by returning 0 when not playing. if (state_ != kPlaying) { - return 0; + // TODO(scherkus): To keep the audio hardware busy we write at most 8k of + // zeros. This gets around the tricky situation of pausing and resuming + // the audio IPC layer in Chrome. Ideally, we should return zero and then + // the subclass can restart the conversation. + const size_t kZeroLength = 8192; + dest_written = std::min(kZeroLength, dest_len); + memset(dest, 0, dest_written); + return dest_written; } // Save a local copy of last fill buffer time and reset the member. |