Bug 1410225 - return the pending seek promise for SeekToNextFrame() when a seek is already in action. draft
authorJW Wang <jwwang@mozilla.com>
Fri, 20 Oct 2017 16:37:35 +0800
changeset 684576 20558857bb7d4c1162c6c7de70522dc3ad3a845d
parent 683825 611acb9086580700ed0e856eefedd5aae96f081a
child 736895 3de979b647b6b7bf44e2b83e6a044177952ac912
push id85650
push userjwwang@mozilla.com
push dateMon, 23 Oct 2017 04:35:49 +0000
bugs1410225
milestone58.0a1
Bug 1410225 - return the pending seek promise for SeekToNextFrame() when a seek is already in action. MDSM doesn't reset the decoding pipeline of MFR when doing NextFrameSeek and therefore fails the assertion by requesting video data while MFR is still seeking. We put the fix in the media element because it doesn't make sense to do NextFrameSeek while another seek is already in action. MozReview-Commit-ID: D6FSiNWHrLU
dom/html/HTMLMediaElement.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -2677,16 +2677,22 @@ HTMLMediaElement::FastSeek(double aTime,
   LOG(LogLevel::Debug, ("Reporting telemetry VIDEO_FASTSEEK_USED"));
   Telemetry::Accumulate(Telemetry::VIDEO_FASTSEEK_USED, 1);
   RefPtr<Promise> tobeDropped = Seek(aTime, SeekTarget::PrevSyncPoint, aRv);
 }
 
 already_AddRefed<Promise>
 HTMLMediaElement::SeekToNextFrame(ErrorResult& aRv)
 {
+  if (mSeekDOMPromise) {
+    // We can't perform NextFrameSeek while seek is already in action.
+    // Just return the pending seek promise.
+    return do_AddRef(mSeekDOMPromise);
+  }
+
   /* This will cause JIT code to be kept around longer, to help performance
    * when using SeekToNextFrame to iterate through every frame of a video.
    */
   nsCOMPtr<nsIGlobalObject> global =
     do_QueryInterface(OwnerDoc()->GetInnerWindow());
 
   if (global) {
     if (JSObject *obj = global->GetGlobalJSObject()) {