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

Unified Diff: media/capture/webm_muxer.h

Issue 1414793002: Update WebmMuxer for audio component of MediaStream recording. (Closed) 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
Index: media/capture/webm_muxer.h
diff --git a/media/capture/webm_muxer.h b/media/capture/webm_muxer.h
index 7196d1d4f9f33c95b88548ab8ba92dd3589015c1..36cbf3a6e4e6bde2de65e463fcdbb0d0d74855be 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,14 +42,21 @@ 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;
@@ -59,6 +67,9 @@ class MEDIA_EXPORT WebmMuxer : public NON_EXPORTED_BASE(mkvmuxer::IMkvWriter) {
// frame size.
void AddVideoTrack(const gfx::Size& frame_size, double frame_rate);
+ // Creates and adds a new audio track. bla bla bla
mcasas 2015/10/28 00:42:02 :)
ajose 2015/10/28 23:43:47 oy vey
+ void AddAudioTrack(const media::AudioParameters& params);
+
// IMkvWriter interface.
mkvmuxer::int32 Write(const void* buf, mkvmuxer::uint32 len) override;
mkvmuxer::int64 Position() const override;
@@ -73,12 +84,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_;

Powered by Google App Engine
This is Rietveld 408576698