diff options
author | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:47:08 +0000 |
---|---|---|
committer | hclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-19 21:47:08 +0000 |
commit | 33e8ff5adfe21d38e978f0e294e02d338262498f (patch) | |
tree | bc874ab93918582019aa2aae1cd1b1f8a11d64ab /media | |
parent | 9e77708df21ca781641decfddf009f7bb426a0d2 (diff) | |
download | chromium_src-33e8ff5adfe21d38e978f0e294e02d338262498f.zip chromium_src-33e8ff5adfe21d38e978f0e294e02d338262498f.tar.gz chromium_src-33e8ff5adfe21d38e978f0e294e02d338262498f.tar.bz2 |
Prevent current time jumping around when seek
BUG=19396
TEST=Open a .ogg file, seek, now the thumb won't jumps to 0 back and forth again.
Using a <video> to play a video file, when you seek
(especially ogg files) it will jump to time = 0 and
jumps back to the desired seek position back and forth.
This is because ogg files are muxed in a way that
audio packets have large gaps between valid timestamps.
This patch will avoid using invalid timestamps from
audio packets to estimate the current time.
Review URL: http://codereview.chromium.org/173027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/filters/ffmpeg_audio_decoder.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc index 6f4f5e1..e103093 100644 --- a/media/filters/ffmpeg_audio_decoder.cc +++ b/media/filters/ffmpeg_audio_decoder.cc @@ -128,9 +128,16 @@ void FFmpegAudioDecoder::OnDecode(Buffer* input) { result_buffer->SetTimestamp(input->GetTimestamp()); } - // Update our estimated timestamp for the next packet. - estimated_next_timestamp_ = result_buffer->GetTimestamp() + - result_buffer->GetDuration(); + // Only use the timestamp of |result_buffer| to estimate the next timestamp + // if it is valid (i.e. greater than 0). Otherwise the error will stack + // together and we will get a series of incorrect timestamps. In this case, + // this will maintain a series of zero timestamps. + // TODO(hclam): We should use another invalid value other than 0. + if (result_buffer->GetTimestamp().InMicroseconds() > 0) { + // Update our estimated timestamp for the next packet. + estimated_next_timestamp_ = result_buffer->GetTimestamp() + + result_buffer->GetDuration(); + } EnqueueResult(result_buffer); return; |