Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: media/filters/ffmpeg_demuxer.cc

Issue 562323002: Don't rebase timestamps for positive start times. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer.cc
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 9df765e8f161c4051c804c81fea7be5e090a357c..24e9357f9b566f58ccbf625de7bc281724a77b12 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -305,6 +305,12 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
start_time = base::TimeDelta();
}
+ // Don't rebase timestamps for positive start times, the HTML Media Spec
+ // details this in section "4.8.10.6 Offsets into the media resource." We
+ // will still need to rebase timestamps before seeking with FFmpeg though.
+ if (start_time > base::TimeDelta())
+ start_time = base::TimeDelta();
+
buffer->set_timestamp(stream_timestamp - start_time);
// If enabled, mark audio packets with negative timestamps for post-decode
@@ -588,7 +594,16 @@ void FFmpegDemuxer::Seek(base::TimeDelta time, const PipelineStatusCB& cb) {
// we know we're going to drop it on the floor.
// FFmpeg requires seeks to be adjusted according to the lowest starting time.
- const base::TimeDelta seek_time = time + start_time_;
+ // Since EnqueuePacket() rebased negative timestamps by the start time, we
+ // must correct the shift here.
+ //
+ // Additionally, to workaround limitations in how we expose seekable ranges to
+ // blink, we also want to special case seeks to zero; they're unambiguously
acolwell GONE FROM CHROMIUM 2014/09/11 18:34:42 nit: Please file a bug to track the seekable range
DaleCurtis 2014/09/11 19:19:07 Done.
+ // intended to seek to the start of the media.
+ const base::TimeDelta seek_time =
+ start_time_ < base::TimeDelta() || time == base::TimeDelta()
acolwell GONE FROM CHROMIUM 2014/09/11 18:34:42 Why not simply set seek_time to start_time_ if tim
DaleCurtis 2014/09/11 19:19:07 Done.
+ ? time + start_time_
+ : time;
// Choose the seeking stream based on whether it contains the seek time, if no
// match can be found prefer the preferred stream.
« no previous file with comments | « no previous file | media/filters/ffmpeg_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698