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

Unified Diff: media/filters/media_source_state.h

Issue 2226443002: Support multiple media tracks in MSE / ChunkDemuxer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mp4 format is not supported on some trybots, so use webm Created 4 years, 3 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/filters/media_source_state.h
diff --git a/media/filters/media_source_state.h b/media/filters/media_source_state.h
index 47ebc5888e9fabb4cbb7e25782d499e3e9b47f7c..5827abb36bbfb57674d17c656b038fb36c3cc06a 100644
--- a/media/filters/media_source_state.h
+++ b/media/filters/media_source_state.h
@@ -41,8 +41,7 @@ class MEDIA_EXPORT MediaSourceState {
~MediaSourceState();
void Init(const StreamParser::InitCB& init_cb,
- bool allow_audio,
- bool allow_video,
+ const std::string& expected_codecs,
const StreamParser::EncryptedMediaInitDataCB&
encrypted_media_init_data_cb,
const NewTextTrackCB& new_text_track_cb);
@@ -136,8 +135,7 @@ class MEDIA_EXPORT MediaSourceState {
// encountered.
// Returns true on a successful call. Returns false if an error occurred while
// processing decoder configurations.
- bool OnNewConfigs(bool allow_audio,
- bool allow_video,
+ bool OnNewConfigs(std::string expected_codecs,
std::unique_ptr<MediaTracks> tracks,
const StreamParser::TextTrackConfigMap& text_configs);
@@ -163,6 +161,9 @@ class MEDIA_EXPORT MediaSourceState {
// (and therefore before parsing is performed) to prepare space for new data.
size_t EstimateVideoDataSize(size_t muxed_data_chunk_size) const;
+ // Sets memory limits for all demuxer streams.
+ void SetStreamMemoryLimits();
+
// Tracks the number of MEDIA_LOGs emitted for segments missing expected audio
// or video blocks. Useful to prevent log spam.
int num_missing_track_logs_ = 0;
@@ -186,16 +187,17 @@ class MEDIA_EXPORT MediaSourceState {
bool parsing_media_segment_;
// Valid only while |parsing_media_segment_| is true. These flags enable
- // warning when at least one frame for each A/V track is not in a parsed media
- // segment.
- bool media_segment_contained_audio_frame_;
- bool media_segment_contained_video_frame_;
+ // warning when the parsed media segment doesn't have frames for some track.
+ std::map<StreamParser::TrackId, bool> media_segment_has_data_for_track_;
// The object used to parse appended data.
std::unique_ptr<StreamParser> stream_parser_;
- ChunkDemuxerStream* audio_; // Not owned by |this|.
- ChunkDemuxerStream* video_; // Not owned by |this|.
+ // Note that ChunkDemuxerStreams are created and owned by the parent
+ // ChunkDemuxer. They are not owned by |this|.
+ using DemuxerStreamMap = std::map<StreamParser::TrackId, ChunkDemuxerStream*>;
+ DemuxerStreamMap audio_streams_;
+ DemuxerStreamMap video_streams_;
typedef std::map<StreamParser::TrackId, ChunkDemuxerStream*> TextStreamMap;
TextStreamMap text_stream_map_; // |this| owns the map's stream pointers.
@@ -214,6 +216,7 @@ class MEDIA_EXPORT MediaSourceState {
// invoke this callback.
Demuxer::MediaTracksUpdatedCB init_segment_received_cb_;
bool append_in_progress_ = false;
+ bool first_init_segment_received_ = false;
// Indicates that timestampOffset should be updated automatically during
// OnNewBuffers() based on the earliest end timestamp of the buffers provided.

Powered by Google App Engine
This is Rietveld 408576698