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

Unified Diff: media/filters/media_source_state.h

Issue 1843823003: MSE: Protect better against out-of-sequence parser callbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_597447_1
Patch Set: Removed patchset dependency - this can land by itself Created 4 years, 9 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 | « no previous file | media/filters/media_source_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/media_source_state.h
diff --git a/media/filters/media_source_state.h b/media/filters/media_source_state.h
index e6878f6071ce9efe5ac11232970f01395d60a43a..89974a6b506e2971566d840439232bafc411b1e7 100644
--- a/media/filters/media_source_state.h
+++ b/media/filters/media_source_state.h
@@ -116,6 +116,16 @@ class MEDIA_EXPORT MediaSourceState {
void SetTracksWatcher(const Demuxer::MediaTracksUpdatedCB& tracks_updated_cb);
private:
+ // State advances through this list. The intent is to ensure at least one
+ // config is received prior to parser calling initialization callback, and
+ // that such initialization callback occurs at most once per parser.
+ enum State {
+ UNINITIALIZED = 0,
+ PENDING_PARSER_CONFIG,
+ PENDING_PARSER_INIT,
+ PARSER_INITIALIZED
+ };
+
// Called by the |stream_parser_| when a new initialization segment is
// encountered.
// Returns true on a successful call. Returns false if an error occurred while
@@ -192,6 +202,8 @@ class MEDIA_EXPORT MediaSourceState {
scoped_refptr<MediaLog> media_log_;
StreamParser::InitCB init_cb_;
+ State state_;
+
// During Append(), OnNewConfigs() will trigger the initialization segment
// received algorithm. Note, the MSE spec explicitly disallows this algorithm
// during an Abort(), since Abort() is allowed only to emit coded frames, and
« no previous file with comments | « no previous file | media/filters/media_source_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698