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

Unified Diff: media/filters/chunk_demuxer.cc

Issue 2273273002: Directly call ChunkDemuxer::Initialize completion callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update ChunkDemuxerTest 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
« no previous file with comments | « no previous file | media/filters/chunk_demuxer_unittest.cc » ('j') | media/filters/chunk_demuxer_unittest.cc » ('J')
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 443c7c5558873ff0326294e29c72a53bb6ca0ab3..d9a1f5c1d86169650e12b8b1ec7705a38e501bcf 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -432,15 +432,20 @@ void ChunkDemuxer::Initialize(
DVLOG(1) << "Init()";
base::AutoLock auto_lock(lock_);
-
- // The |init_cb_| must only be run after this method returns, so always post.
- init_cb_ = BindToCurrentLoop(cb);
if (state_ == SHUTDOWN) {
- base::ResetAndReturn(&init_cb_).Run(DEMUXER_ERROR_COULD_NOT_OPEN);
+ // Init cb must only be run after this method returns, so always post.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(cb, DEMUXER_ERROR_COULD_NOT_OPEN));
return;
}
+
DCHECK_EQ(state_, WAITING_FOR_INIT);
host_ = host;
+ // Do not post init_cb once this function returns because if there is an
+ // error after initialization, the error might be reported before init_cb
+ // has a chance to run. This is because ChunkDemuxer::ReportError_Locked
+ // directly calls DemuxerHost::OnDemuxerError: crbug.com/633016.
+ init_cb_ = cb;
enable_text_ = enable_text_tracks;
ChangeState_Locked(INITIALIZING);
« no previous file with comments | « no previous file | media/filters/chunk_demuxer_unittest.cc » ('j') | media/filters/chunk_demuxer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698