| 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);
|
|
|