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

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: removes comment Created 4 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
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | 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 1ce107e9e79b17bfe93be98bbf68796c4e6986d5..a5b17e18ed0aecbd6b643bd92c0a5280788eb9a6 100644
--- a/media/filters/chunk_demuxer.cc
+++ b/media/filters/chunk_demuxer.cc
@@ -424,22 +424,26 @@ std::string ChunkDemuxer::GetDisplayName() const {
return "ChunkDemuxer";
}
-void ChunkDemuxer::Initialize(
- DemuxerHost* host,
- const PipelineStatusCB& cb,
- bool enable_text_tracks) {
+void ChunkDemuxer::Initialize(DemuxerHost* host,
+ const PipelineStatusCB& init_cb,
+ bool enable_text_tracks) {
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 post.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(init_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_ = init_cb;
enable_text_ = enable_text_tracks;
ChangeState_Locked(INITIALIZING);
« no previous file with comments | « media/filters/chunk_demuxer.h ('k') | media/filters/chunk_demuxer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698