| Index: media/capture/webm_muxer.h
|
| diff --git a/media/capture/webm_muxer.h b/media/capture/webm_muxer.h
|
| index eb93e005a5ad7170929b80f2ab034aaa60ee80ba..153e14fd942d995047e1c7c935f465b79cae42ee 100644
|
| --- a/media/capture/webm_muxer.h
|
| +++ b/media/capture/webm_muxer.h
|
| @@ -19,15 +19,16 @@
|
|
|
| namespace media {
|
|
|
| +class VideoFrame;
|
| +
|
| // Adapter class to manage a WebM container [1], a simplified version of a
|
| // Matroska container [2], composed of an EBML header, and a single Segment
|
| // including at least a Track Section and a number of SimpleBlocks each
|
| // containing a single encoded video frame. WebM container has no Trailer.
|
| -// Clients will push encoded VPx video frames one by one via OnEncodedVideo()
|
| -// with indication of the Track they belong to, and libwebm will eventually ping
|
| -// the WriteDataCB passed on contructor with the wrapped encoded data. All
|
| -// operations must happen in a single thread, where WebmMuxer is created and
|
| -// destroyed.
|
| +// Clients will push encoded VPx video frames one by one via the
|
| +// OnEncodedVideo(). libwebm will eventually ping the WriteDataCB passed on
|
| +// contructor with the wrapped encoded data. All operations must happen in a
|
| +// single thread, where WebmMuxer is created and destroyed.
|
| // [1] http://www.webmproject.org/docs/container/
|
| // [2] http://www.matroska.org/technical/specs/index.html
|
| // TODO(mcasas): Add support for Audio muxing.
|
| @@ -41,24 +42,24 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
|
| explicit WebmMuxer(const WriteDataCB& write_data_callback);
|
| ~WebmMuxer() override;
|
|
|
| - // Creates and adds a new video track. Called before receiving the first
|
| - // frame of a given Track, adds |frame_size| and |frame_rate| to the Segment
|
| - // info, although individual frames passed to OnEncodedVideo() can have any
|
| - // frame size. Returns the track_index to be used for OnEncodedVideo().
|
| - uint64_t AddVideoTrack(const gfx::Size& frame_size, double frame_rate);
|
| -
|
| - // Adds a frame with |encoded_data.data()| to WebM Segment. |track_number| is
|
| - // a caller-side identifier and must have been provided by AddVideoTrack().
|
| + // Adds a |video_frame| with |encoded_data.data()| to WebM Segment.
|
| // TODO(mcasas): Revisit how |encoded_data| is passed once the whole recording
|
| // chain is setup (http://crbug.com/262211).
|
| - void OnEncodedVideo(uint64_t track_number,
|
| + void OnEncodedVideo(const scoped_refptr<VideoFrame>& video_frame,
|
| const base::StringPiece& encoded_data,
|
| - base::TimeDelta timestamp,
|
| - bool keyframe);
|
| + base::TimeTicks timestamp,
|
| + bool is_key_frame);
|
|
|
| private:
|
| friend class WebmMuxerTest;
|
|
|
| + // Creates and adds a new video track. Called upon receiving the first
|
| + // frame of a given Track, adds |frame_size| and |frame_rate| to the Segment
|
| + // info, although individual frames passed to OnEncodedVideo() can have any
|
| + // frame size. Returns OnEncodedVideo() callback with a |track_number| bound
|
| + // in the callback.
|
| + void AddVideoTrack(const gfx::Size& frame_size, double frame_rate);
|
| +
|
| // IMkvWriter interface.
|
| mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
|
| mkvmuxer::int64 Position() const override;
|
| @@ -70,6 +71,13 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
|
| // Used to DCHECK that we are called on the correct thread.
|
| base::ThreadChecker thread_checker_;
|
|
|
| + // A caller-side identifier to interact with |segment_|, initialised upon
|
| + // first frame arrival by AddVideoTrack().
|
| + uint64_t track_index_;
|
| +
|
| + // Origin of times for frame timestamps.
|
| + base::TimeTicks first_frame_timestamp_;
|
| +
|
| // Callback to dump written data as being called by libwebm.
|
| const WriteDataCB write_data_callback_;
|
|
|
|
|