Index: media/filters/ffmpeg_demuxer.h |
diff --git a/media/filters/ffmpeg_demuxer.h b/media/filters/ffmpeg_demuxer.h |
index 02682bbc8b2c38c4b3a07771a7c86558c595bfb9..ebea927b9fda10281cf767557d3bd0b2c0c5c4ab 100644 |
--- a/media/filters/ffmpeg_demuxer.h |
+++ b/media/filters/ffmpeg_demuxer.h |
@@ -74,8 +74,7 @@ class FFmpegDemuxerStream : public DemuxerStream { |
// Empties the queues and ignores any additional calls to Read(). |
void Stop(); |
- // Returns the duration of this stream. |
- base::TimeDelta duration(); |
+ base::TimeDelta duration() const { return duration_; } |
// DemuxerStream implementation. |
virtual Type type() OVERRIDE; |
@@ -104,6 +103,12 @@ class FFmpegDemuxerStream : public DemuxerStream { |
// Returns an empty string if the key is not present. |
std::string GetMetadata(const char* key) const; |
+ // Tells the DemuxerStream that all packets with negative timestamps should be |
+ // marked for post-decode discard. |
+ void enable_negative_timestamp_discard() { |
+ discard_negative_timestamps_ = true; |
+ } |
+ |
private: |
friend class FFmpegDemuxerTest; |
@@ -136,6 +141,7 @@ class FFmpegDemuxerStream : public DemuxerStream { |
bool bitstream_converter_enabled_; |
std::string encryption_key_id_; |
+ bool discard_negative_timestamps_; |
DISALLOW_COPY_AND_ASSIGN(FFmpegDemuxerStream); |
}; |
@@ -155,7 +161,6 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
virtual void Stop(const base::Closure& callback) OVERRIDE; |
virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE; |
virtual DemuxerStream* GetStream(DemuxerStream::Type type) OVERRIDE; |
- virtual base::TimeDelta GetStartTime() const OVERRIDE; |
virtual base::Time GetTimelineOffset() const OVERRIDE; |
virtual Liveness GetLiveness() const OVERRIDE; |
@@ -168,6 +173,10 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
void NotifyCapacityAvailable(); |
void NotifyBufferingChanged(); |
+ // The lowest demuxed timestamp. DemuxerStream's must use this to adjust |
+ // packet timestamps such that external clients see a zero-based timeline. |
+ base::TimeDelta start_time() const { return start_time_; } |
+ |
private: |
// To allow tests access to privates. |
friend class FFmpegDemuxerTest; |
@@ -245,9 +254,9 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
// Derived bitrate after initialization has completed. |
int bitrate_; |
- // The first timestamp of the opened media file. This is used to set the |
- // starting clock value to match the timestamps in the media file. Default |
- // is 0. |
+ // The first timestamp of the audio or video stream, whichever is lower. This |
+ // is used to adjust timestamps so that external consumers always see a zero |
+ // based timeline. |
base::TimeDelta start_time_; |
// The Time associated with timestamp 0. Set to a null |
@@ -270,6 +279,10 @@ class MEDIA_EXPORT FFmpegDemuxer : public Demuxer { |
const NeedKeyCB need_key_cb_; |
+ // The index of the stream in |streams_| to use for seeking. Chosen by the |
+ // stream with the lowest starting timestamp. |
+ int stream_index_for_seeking_; |
+ |
// NOTE: Weak pointers must be invalidated before all other member variables. |
base::WeakPtrFactory<FFmpegDemuxer> weak_factory_; |