diff options
Diffstat (limited to 'chromium/media/filters/source_buffer_stream.h')
-rw-r--r-- | chromium/media/filters/source_buffer_stream.h | 68 |
1 files changed, 61 insertions, 7 deletions
diff --git a/chromium/media/filters/source_buffer_stream.h b/chromium/media/filters/source_buffer_stream.h index 4b00504cfb2..95b2e0970b1 100644 --- a/chromium/media/filters/source_buffer_stream.h +++ b/chromium/media/filters/source_buffer_stream.h @@ -32,7 +32,7 @@ class SourceBufferRange; // See file-level comment for complete description. class MEDIA_EXPORT SourceBufferStream { public: - typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; + typedef StreamParser::BufferQueue BufferQueue; // Status returned by GetNextBuffer(). // kSuccess: Indicates that the next buffer was returned. @@ -46,12 +46,21 @@ class MEDIA_EXPORT SourceBufferStream { kEndOfStream }; + enum Type { + kAudio, + kVideo, + kText + }; + SourceBufferStream(const AudioDecoderConfig& audio_config, - const LogCB& log_cb); + const LogCB& log_cb, + bool splice_frames_enabled); SourceBufferStream(const VideoDecoderConfig& video_config, - const LogCB& log_cb); + const LogCB& log_cb, + bool splice_frames_enabled); SourceBufferStream(const TextTrackConfig& text_config, - const LogCB& log_cb); + const LogCB& log_cb, + bool splice_frames_enabled); ~SourceBufferStream(); @@ -102,6 +111,11 @@ class MEDIA_EXPORT SourceBufferStream { // Returns a list of the buffered time ranges. Ranges<base::TimeDelta> GetBufferedTime() const; + // Returns the duration of the buffered ranges, which is equivalent + // to the end timestamp of the last buffered range. If no data is buffered + // then base::TimeDelta() is returned. + base::TimeDelta GetBufferedDuration() const; + // Notifies this object that end of stream has been signalled. void MarkEndOfStream(); @@ -260,8 +274,8 @@ class MEDIA_EXPORT SourceBufferStream { // have a keyframe after |timestamp| then kNoTimestamp() is returned. base::TimeDelta FindKeyframeAfterTimestamp(const base::TimeDelta timestamp); - // Returns "VIDEO" for a video SourceBufferStream and "AUDIO" for an audio - // one. + // Returns "VIDEO" for a video SourceBufferStream, "AUDIO" for an audio + // stream, and "TEXT" for a text stream. std::string GetStreamTypeName() const; // Returns true if we don't have any ranges or the last range is selected @@ -286,7 +300,32 @@ class MEDIA_EXPORT SourceBufferStream { base::TimeDelta start, base::TimeDelta end, bool is_exclusive, BufferQueue* deleted_buffers); - bool is_video() const { return video_configs_.size() > 0; } + Type GetType() const; + + // See GetNextBuffer() for additional details. This method handles splice + // frame processing. + Status HandleNextBufferWithSplice( + scoped_refptr<StreamParserBuffer>* out_buffer); + + // See GetNextBuffer() for additional details. This method handles preroll + // frame processing. + Status HandleNextBufferWithPreroll( + scoped_refptr<StreamParserBuffer>* out_buffer); + + // See GetNextBuffer() for additional details. The internal method hands out + // single buffers from the |track_buffer_| and |selected_range_| without + // additional processing for splice frame or preroll buffers. + Status GetNextBufferInternal(scoped_refptr<StreamParserBuffer>* out_buffer); + + // Called by PrepareRangesForNextAppend() before pruning overlapped buffers to + // generate a splice frame with a small portion of the overlapped buffers. If + // a splice frame is generated, the first buffer in |new_buffers| will have + // its timestamps, duration, and fade out preroll updated. + void GenerateSpliceFrame(const BufferQueue& new_buffers); + + // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_| + // appropriately and returns true. Otherwise returns false. + bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); // Callback used to report error strings that can help the web developer // figure out what is wrong with the content. @@ -364,6 +403,21 @@ class MEDIA_EXPORT SourceBufferStream { // GetCurrentXXXDecoderConfig() has been called. bool config_change_pending_; + // Used by HandleNextBufferWithSplice() or HandleNextBufferWithPreroll() when + // a splice frame buffer or buffer with preroll is returned from + // GetNextBufferInternal(). + scoped_refptr<StreamParserBuffer> pending_buffer_; + + // Indicates which of the splice buffers in |splice_buffer_| should be + // handled out next. + size_t splice_buffers_index_; + + // Indicates that all buffers before |pending_buffer_| have been handed out. + bool pending_buffers_complete_; + + // Indicates that splice frame generation is enabled. + const bool splice_frames_enabled_; + DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); }; |