Index: media/capture/webm_muxer.h |
diff --git a/media/capture/webm_muxer.h b/media/capture/webm_muxer.h |
index 7196d1d4f9f33c95b88548ab8ba92dd3589015c1..f349bfa60f919da37049fa5e2087ea5c26575d47 100644 |
--- a/media/capture/webm_muxer.h |
+++ b/media/capture/webm_muxer.h |
@@ -21,6 +21,7 @@ class Size; |
namespace media { |
class VideoFrame; |
+class AudioParameters; |
// 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 |
@@ -41,23 +42,32 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) { |
// |codec| can be VP8 or VP9 and should coincide with whatever is sent in |
// OnEncodedVideo(). |
- WebmMuxer(VideoCodec codec, const WriteDataCB& write_data_callback); |
+ WebmMuxer(VideoCodec codec, |
+ size_t num_video_tracks, |
+ size_t num_audio_tracks, |
+ const WriteDataCB& write_data_callback); |
~WebmMuxer() override; |
- // Adds a |video_frame| with |encoded_data.data()| to WebM Segment. |
+ // Functions to add video and audio frames with |encoded_data.data()| |
+ // to WebM Segment. |
void OnEncodedVideo(const scoped_refptr<VideoFrame>& video_frame, |
scoped_ptr<std::string> encoded_data, |
base::TimeTicks timestamp, |
bool is_key_frame); |
+ void OnEncodedAudio(const media::AudioParameters& params, |
+ scoped_ptr<std::string> encoded_data, |
+ base::TimeTicks timestamp); |
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 |
+ // Methods for creating and adding video and audio tracks, called upon |
+ // receiving the first frame of a given Track. |
+ // AddVideoTrack 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); |
+ void AddAudioTrack(const media::AudioParameters& params); |
// IMkvWriter interface. |
mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override; |
@@ -73,12 +83,17 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) { |
// Video Codec configured: VP9 if true, otherwise VP8 is used by default. |
const bool use_vp9_; |
- // A caller-side identifier to interact with |segment_|, initialised upon |
- // first frame arrival by AddVideoTrack(). |
- uint64_t track_index_; |
+ // Caller-side identifiers to interact with |segment_|, initialised upon |
+ // first frame arrival to Add{Video, Audio}Track(). |
+ uint64_t video_track_index_; |
+ uint64_t audio_track_index_; |
// Origin of times for frame timestamps. |
base::TimeTicks first_frame_timestamp_; |
+ base::TimeDelta most_recent_timestamp_; |
+ |
+ bool has_video_; |
+ bool has_audio_; |
// Callback to dump written data as being called by libwebm. |
const WriteDataCB write_data_callback_; |