From 4d6d7238d7bda8378e42a7154cf63ef66294fd31 Mon Sep 17 00:00:00 2001 From: JW Wang Date: Mon, 8 Jan 2018 14:51:57 +0800 Subject: [PATCH] Bug 1429009. P1 - notify 'DownloadProgressed' immediately to preserve the event order. r=bechen,gerald We also need to call GetOwner()->UpdateReadyState() since mCanPlayThrough might have changed. MozReview-Commit-ID: C5djzu1sXqV --HG-- extra : rebase_source : 1037cb7e1bf3a32fa60451e9a2a64ce63d06b8c2 extra : intermediate-source : 373c47f094dfb85ca2576d18a302d9ceb4e82ed5 extra : source : b710ff5026c18ac851be56ac9a369fe69b1d5b5d --- dom/media/ChannelMediaDecoder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dom/media/ChannelMediaDecoder.cpp b/dom/media/ChannelMediaDecoder.cpp index 92950d7cbc05..6c4d1a26005f 100644 --- a/dom/media/ChannelMediaDecoder.cpp +++ b/dom/media/ChannelMediaDecoder.cpp @@ -413,6 +413,8 @@ ChannelMediaDecoder::DownloadProgressed() MOZ_ASSERT(NS_IsMainThread()); MOZ_DIAGNOSTIC_ASSERT(!IsShutdown()); + GetOwner()->DownloadProgressed(); + using StatsPromise = MozPromise; InvokeAsync(GetStateMachine()->OwnerThread(), __func__, @@ -438,7 +440,8 @@ ChannelMediaDecoder::DownloadProgressed() GetStateMachine()->DispatchCanPlayThrough(mCanPlayThrough); mResource->ThrottleReadahead(ShouldThrottleDownload(aStats)); AbstractThread::AutoEnter context(AbstractMainThread()); - GetOwner()->DownloadProgressed(); + // Update readyState since mCanPlayThrough might have changed. + GetOwner()->UpdateReadyState(); }, []() { MOZ_ASSERT_UNREACHABLE("Promise not resolved"); }); }