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

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: fix windows 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
Index: media/filters/chunk_demuxer.h
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index ced6d97759128200facc3b07f12b01273b72841e..e2df508d8507656befd42bccc61a815230b33a1b 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -22,6 +22,7 @@ namespace media {
class ChunkDemuxerClient;
class ChunkDemuxerStream;
class FFmpegURLProtocol;
+class SourceInfo;
acolwell GONE FROM CHROMIUM 2012/07/25 18:22:43 nit: I don't think you need this anymore since it
vrk (LEFT CHROMIUM) 2012/07/25 22:56:50 Done.
// Demuxer implementation that allows chunks of media data to be passed
// from JavaScript to the media stack.
@@ -74,6 +75,10 @@ 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|.
+ bool SetTimestampOffset(const std::string& id, float offset);
acolwell GONE FROM CHROMIUM 2012/07/25 18:22:43 Document return value. I'm assuming returning fals
vrk (LEFT CHROMIUM) 2012/07/25 22:56:50 Done.
+
// 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 +122,16 @@ 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);
+
mutable base::Lock lock_;
State state_;
@@ -138,6 +148,14 @@ class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
typedef std::map<std::string, StreamParser*> StreamParserMap;
StreamParserMap stream_parser_map_;
+ // Contains state belonging to a media source.
acolwell GONE FROM CHROMIUM 2012/07/25 18:22:43 s/media source/source ID?
vrk (LEFT CHROMIUM) 2012/07/25 22:56:50 yeah that sounds a bit better, changed!
+ 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).

Powered by Google App Engine
This is Rietveld 408576698