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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 1839763005: MSE: Protect better against reaching HAVE_METADATA too early (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased onto https://codereview.chromium.org/1826583003/. Ready for final review. 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 | « media/filters/chunk_demuxer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.cc
diff --git a/media/filters/chunk_demuxer.cc b/media/filters/chunk_demuxer.cc
index c0ecf5762cfbe05e5ad52ae675ec3e43e4699a40..53ce1f3ec09c046598f5a0b9f5c9a2aa9254ecfa 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -365,6 +365,7 @@ ChunkDemuxer::ChunkDemuxer(
encrypted_media_init_data_cb_(encrypted_media_init_data_cb),
enable_text_(false),
media_log_(media_log),
+ pending_source_init_done_count_(0),
duration_(kNoTimestamp()),
user_specified_duration_(-1),
liveness_(DemuxerStream::LIVENESS_UNKNOWN),
@@ -545,6 +546,8 @@ ChunkDemuxer::Status ChunkDemuxer::AddId(const std::string& id,
base::Unretained(this));
}
+ pending_source_init_done_count_++;
+
source_state->Init(
base::Bind(&ChunkDemuxer::OnSourceInitDone, base::Unretained(this)),
has_audio, has_video, encrypted_media_init_data_cb_, new_text_track_cb);
@@ -970,11 +973,14 @@ void ChunkDemuxer::OnSourceInitDone(
detected_text_track_count_ += params.detected_text_track_count;
// Wait until all streams have initialized.
- // TODO(wolenetz): Make this gate less fragile. See https://crbug.com/597447.
- if ((!source_id_audio_.empty() && !audio_) ||
- (!source_id_video_.empty() && !video_)) {
+ pending_source_init_done_count_--;
+
+ if (pending_source_init_done_count_ > 0)
return;
- }
+
+ DCHECK_EQ(0, pending_source_init_done_count_);
+ DCHECK((source_id_audio_.empty() == !audio_) &&
+ (source_id_video_.empty() == !video_));
// Record detected track counts by type corresponding to an MSE playback.
// Counts are split into 50 buckets, capped into [0,100] range.
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698