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

Unified Diff: media/filters/chunk_demuxer.h

Issue 10803019: Chrome-side implementation of media source timestamp offset (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase ToT Created 8 years, 5 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 | « media/base/stream_parser.h ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.h
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index ced6d97759128200facc3b07f12b01273b72841e..773f1d52a6b5b18fef7237f561d7f6603334ab08 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -74,6 +74,12 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
// it can accept a new segment.
void Abort(const std::string& id);
+ // Sets a time |offset| in seconds to be applied to subsequent buffers
+ // appended to the source buffer assicated with |id|. Returns true if the
+ // offset is set properly, false if the offset cannot be applied because we're
+ // in the middle of parsing a media segment.
+ bool SetTimestampOffset(const std::string& id, double offset);
+
// Signals an EndOfStream request.
// Returns false if called in an unexpected state or if there is a gap between
// the current position and the end of the buffered data.
@@ -117,11 +123,19 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
bool OnNeedKey(scoped_array<uint8> init_data, int init_data_size);
void OnNewMediaSegment(const std::string& source_id,
base::TimeDelta start_timestamp);
+ void OnEndOfMediaSegment(const std::string& source_id);
// Computes the intersection between the video & audio
// buffered ranges.
Ranges<base::TimeDelta> ComputeIntersection() const;
+ // Applies |time_offset| to the timestamps of |buffers|.
+ void AdjustBufferTimestamps(const StreamParser::BufferQueue& buffers,
+ base::TimeDelta timestamp_offset);
+
+ // Returns true if |source_id| is valid, false otherwise.
+ bool IsValidId(const std::string& source_id) const;
+
mutable base::Lock lock_;
State state_;
@@ -138,6 +152,14 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
typedef std::map<std::string, StreamParser*> StreamParserMap;
StreamParserMap stream_parser_map_;
+ // Contains state belonging to a source id.
+ struct SourceInfo {
+ base::TimeDelta timestamp_offset;
+ bool can_update_offset;
+ };
+ typedef std::map<std::string, SourceInfo> SourceInfoMap;
+ SourceInfoMap source_info_map_;
+
// Used to ensure that (1) config data matches the type and codec provided in
// AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be
// removed with RemoveID() but can not be re-added (yet).
« no previous file with comments | « media/base/stream_parser.h ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698