summaryrefslogtreecommitdiffstats
path: root/media/audio/simple_sources.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 19:01:38 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-08 19:01:38 +0000
commit87e6b1b69003191a0548325d7acac019e0f3777e (patch)
tree9f65b0c00e5419f87299eeb4a12028ff70327671 /media/audio/simple_sources.cc
parent4d220800e2b19f161868732e7e848031a96291cb (diff)
downloadchromium_src-87e6b1b69003191a0548325d7acac019e0f3777e.zip
chromium_src-87e6b1b69003191a0548325d7acac019e0f3777e.tar.gz
chromium_src-87e6b1b69003191a0548325d7acac019e0f3777e.tar.bz2
Flush audio data after seek
There is about 400 to 600 ms of audio that needs to be flushed after seek, this have a pretty UX effect. This is partially fixed in this patch by reducing the amount of data down to about at most 500 ms stored in the hardware buffer. This patch clears data in the software buffer in the browser process when seek happens. We could reduce the amount of hardware buffer to further reduce the amount of lag but that can be fixed by subsequent patch. BUG=24150 TEST=audio still works, audio still play after seek the playback of old data after seek is substantially reduced. Few changes in this patch: 1. Flush software buffer after seek in browser process 2. Get rid of prerolling, this actually has not effect at all, so getting rid of useless code Needs to be done after this patch: 1. Further reduce the remaining data after seek and pause 2. Still hit the DCHECK in ClockImpl::Play(), this doesn't seem to be a new problem introduced in this patch Review URL: http://codereview.chromium.org/1508021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43983 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/simple_sources.cc')
-rw-r--r--media/audio/simple_sources.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/media/audio/simple_sources.cc b/media/audio/simple_sources.cc
index 228057b..1edd2b2 100644
--- a/media/audio/simple_sources.cc
+++ b/media/audio/simple_sources.cc
@@ -50,9 +50,8 @@ void SineWaveAudioSource::OnError(AudioOutputStream* stream, int code) {
//////////////////////////////////////////////////////////////////////////////
// PushSource implementation.
-PushSource::PushSource(uint32 packet_size)
- : packet_size_(packet_size),
- buffered_bytes_(0),
+PushSource::PushSource()
+ : buffered_bytes_(0),
front_buffer_consumed_(0) {
}
@@ -115,12 +114,18 @@ uint32 PushSource::UnProcessedBytes() {
return buffered_bytes_;
}
+void PushSource::ClearAll() {
+ // Cleanup() will discard all the data.
+ CleanUp();
+}
+
void PushSource::CleanUp() {
AutoLock auto_lock(lock_);
PacketList::const_iterator it;
for (it = packets_.begin(); it != packets_.end(); ++it) {
delete [] it->buffer;
- buffered_bytes_ -= it->size;
}
packets_.clear();
+ buffered_bytes_ = 0;
+ front_buffer_consumed_ = 0;
}