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

Unified Diff: media/capture/webm_muxer.h

Issue 1352243002: Implemented Multiple video track recoding. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « content/renderer/media/media_recorder_handler.cc ('k') | media/capture/webm_muxer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/capture/webm_muxer.h
diff --git a/media/capture/webm_muxer.h b/media/capture/webm_muxer.h
index 2d25c46a66a40342f8f2e4484dafee2662bf677e..4474c12547f4d0566bde154b8e751f3692c54e73 100644
--- a/media/capture/webm_muxer.h
+++ b/media/capture/webm_muxer.h
@@ -36,6 +36,12 @@ class VideoFrame;
// TODO(mcasas): Add support for Audio muxing.
class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
public:
+ using EncodedVideoCB =
+ base::Callback<void(const scoped_refptr<VideoFrame>& video_frame,
+ scoped_ptr<std::string> encoded_data,
+ base::TimeTicks timestamp,
+ bool is_key_frame)>;
+
// Callback to be called when WebmMuxer is ready to write a chunk of data,
// either any file header or a SingleBlock.
using WriteDataCB = base::Callback<void(base::StringPiece)>;
@@ -43,20 +49,34 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
explicit WebmMuxer(const WriteDataCB& write_data_callback);
~WebmMuxer() override;
+ EncodedVideoCB GenerateOnEncodedVideoCallback();
+
+ private:
+ friend class WebmMuxerTest;
+ struct VideoMuxerArg {
+ VideoMuxerArg(
+ const base::TimeTicks& first_frame_timestamp, uint64 track_number)
+ : first_frame_timestamp(first_frame_timestamp),
+ track_number(track_number) {}
+
+ base::TimeTicks first_frame_timestamp;
+ uint64 track_number;
+ };
+
// Adds a |video_frame| with |encoded_data.data()| to WebM Segment.
- void OnEncodedVideo(const scoped_refptr<VideoFrame>& video_frame,
+ void OnEncodedVideo(int track_index,
+ const scoped_refptr<VideoFrame>& video_frame,
scoped_ptr<std::string> encoded_data,
base::TimeTicks timestamp,
bool is_key_frame);
- private:
- friend class WebmMuxerTest;
+ int GetNextVideoTrackIndex() const;
// 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.
- void AddVideoTrack(const gfx::Size& frame_size, double frame_rate);
+ uint64 AddVideoTrack(const gfx::Size& frame_size, double frame_rate);
// IMkvWriter interface.
mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
@@ -69,12 +89,8 @@ 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_;
+ // Arguments for each tracks to mkvmuxer.
+ std::vector<VideoMuxerArg> video_muxer_args_;
// Callback to dump written data as being called by libwebm.
const WriteDataCB write_data_callback_;
« no previous file with comments | « content/renderer/media/media_recorder_handler.cc ('k') | media/capture/webm_muxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698