diff options
author | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 08:43:04 +0000 |
---|---|---|
committer | wolenetz@chromium.org <wolenetz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-07 08:43:04 +0000 |
commit | 4faac1c3593178ba57c39d52d746d26795ec312a (patch) | |
tree | 7c79ed72eb6d3e1f954190181429b36c73b6ddcc /media/base/stream_parser_buffer.h | |
parent | c87150c24655ecdb09c7a5db547d17c10104b75d (diff) | |
download | chromium_src-4faac1c3593178ba57c39d52d746d26795ec312a.zip chromium_src-4faac1c3593178ba57c39d52d746d26795ec312a.tar.gz chromium_src-4faac1c3593178ba57c39d52d746d26795ec312a.tar.bz2 |
MSE: Add StreamParser buffer remuxing utility and tests
Introduces remuxing utility in stream_parser.h for later refactoring
into fine-grained usage by each stream parser. Adds associated
unit tests.
Modifies StreamParserBuffer so buffers are annotated by type of media
(audio/video/text) and track ID on creation.
This is another prerequisite to implementing MSE-compliant coded frame
processing algorithm in SourceState that requires muxed-in-decode-
timestamp sequence buffers from all media types in the segment
instead of the current sequence per each media type.
R=xhwang@chromium.org
BUG=249422, 341581
TEST=media unittests and MSE layout tests pass locally on Linux.
Review URL: https://codereview.chromium.org/149153002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249634 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/stream_parser_buffer.h')
-rw-r--r-- | media/base/stream_parser_buffer.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/media/base/stream_parser_buffer.h b/media/base/stream_parser_buffer.h index 44ca1ab..146e78a 100644 --- a/media/base/stream_parser_buffer.h +++ b/media/base/stream_parser_buffer.h @@ -6,7 +6,9 @@ #define MEDIA_BASE_STREAM_PARSER_BUFFER_H_ #include "media/base/decoder_buffer.h" +#include "media/base/demuxer_stream.h" #include "media/base/media_export.h" +#include "media/base/stream_parser.h" namespace media { @@ -15,12 +17,17 @@ class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { // Value used to signal an invalid decoder config ID. enum { kInvalidConfigId = -1 }; + typedef DemuxerStream::Type Type; + typedef StreamParser::TrackId TrackId; + static scoped_refptr<StreamParserBuffer> CreateEOSBuffer(); static scoped_refptr<StreamParserBuffer> CopyFrom( - const uint8* data, int data_size, bool is_keyframe); + const uint8* data, int data_size, bool is_keyframe, Type type, + TrackId track_id); static scoped_refptr<StreamParserBuffer> CopyFrom( const uint8* data, int data_size, - const uint8* side_data, int side_data_size, bool is_keyframe); + const uint8* side_data, int side_data_size, bool is_keyframe, Type type, + TrackId track_id); bool IsKeyframe() const { return is_keyframe_; } // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the @@ -28,11 +35,18 @@ class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { base::TimeDelta GetDecodeTimestamp() const; void SetDecodeTimestamp(const base::TimeDelta& timestamp); - // Gets/sets the ID of the decoder config associated with this - // buffer. + // Gets/sets the ID of the decoder config associated with this buffer. int GetConfigId() const; void SetConfigId(int config_id); + // Gets the parser's media type associated with this buffer. Value is + // meaningless for EOS buffers. + Type type() const { return type_; } + + // Gets the parser's track ID associated with this buffer. Value is + // meaningless for EOS buffers. + TrackId track_id() const { return track_id_; } + // Buffers to be exhausted before using the data in this DecoderBuffer. Used // to implement the Audio Splice Frame Algorithm per the MSE specification. const std::vector<scoped_refptr<StreamParserBuffer> >& GetFadeOutPreroll() @@ -43,12 +57,16 @@ class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { private: StreamParserBuffer(const uint8* data, int data_size, const uint8* side_data, int side_data_size, - bool is_keyframe); + bool is_keyframe, Type type, + TrackId track_id); virtual ~StreamParserBuffer(); bool is_keyframe_; base::TimeDelta decode_timestamp_; int config_id_; + Type type_; + TrackId track_id_; + std::vector<scoped_refptr<StreamParserBuffer> > fade_out_preroll_; DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); |