Bug 1343161 - MediaDecoderOwner::DecodeWarning and HTMLMediaElement implementation - r?jya draft
authorGerald Squelart <gsquelart@mozilla.com>
Mon, 27 Feb 2017 12:12:37 +1100
changeset 490631 efa1f079b0f19a85d963b36b8c799dfdd402e39b
parent 490630 8539f535c3269b6fe26f2ecaf6bcc28456a08b05
child 547316 8c9c31af94d9fdeefaaf13668967b8e85ae23e1b
push id47161
push usergsquelart@mozilla.com
push dateTue, 28 Feb 2017 23:08:13 +0000
reviewersjya
bugs1343161
milestone54.0a1
Bug 1343161 - MediaDecoderOwner::DecodeWarning and HTMLMediaElement implementation - r?jya Similar to DecodeError, except we allow decoding to continue. MozReview-Commit-ID: FN9m03o6GXV
dom/html/HTMLMediaElement.cpp
dom/html/HTMLMediaElement.h
dom/media/MediaDecoderOwner.h
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -5281,16 +5281,24 @@ void HTMLMediaElement::DecodeError(const
     }
   } else if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
     NoSupportedMediaSourceError(aError.Description());
   } else {
     Error(MEDIA_ERR_DECODE, aError.Description());
   }
 }
 
+void HTMLMediaElement::DecodeWarning(const MediaResult& aError)
+{
+  nsAutoString src;
+  GetCurrentSrc(src);
+  DecoderDoctorDiagnostics diagnostics;
+  diagnostics.StoreDecodeError(OwnerDoc(), aError, src, __func__);
+}
+
 bool HTMLMediaElement::HasError() const
 {
   return GetError();
 }
 
 void HTMLMediaElement::LoadAborted()
 {
   Error(MEDIA_ERR_ABORTED);
--- a/dom/html/HTMLMediaElement.h
+++ b/dom/html/HTMLMediaElement.h
@@ -170,16 +170,21 @@ public:
   // Called by the video decoder object, on the main thread,
   // when the resource has a network error during loading.
   virtual void NetworkError() final override;
 
   // Called by the video decoder object, on the main thread, when the
   // resource has a decode error during metadata loading or decoding.
   virtual void DecodeError(const MediaResult& aError) final override;
 
+  // Called by the decoder object, on the main thread, when the
+  // resource has a decode issue during metadata loading or decoding, but can
+  // continue decoding.
+  virtual void DecodeWarning(const MediaResult& aError) final override;
+
   // Return true if error attribute is not null.
   virtual bool HasError() const final override;
 
   // Called by the video decoder object, on the main thread, when the
   // resource load has been cancelled.
   virtual void LoadAborted() final override;
 
   // Called by the video decoder object, on the main thread,
--- a/dom/media/MediaDecoderOwner.h
+++ b/dom/media/MediaDecoderOwner.h
@@ -69,16 +69,21 @@ public:
   virtual void NetworkError() = 0;
 
   // Called by the decoder object, on the main thread, when the
   // resource has a decode error during metadata loading or decoding.
   // The decoder owner should call Shutdown() on the decoder and drop the
   // reference to the decoder to prevent further calls into the decoder.
   virtual void DecodeError(const MediaResult& aError) = 0;
 
+  // Called by the decoder object, on the main thread, when the
+  // resource has a decode issue during metadata loading or decoding, but can
+  // continue decoding.
+  virtual void DecodeWarning(const MediaResult& aError) = 0;
+
   // Return true if media element error attribute is not null.
   virtual bool HasError() const = 0;
 
   // Called by the video decoder object, on the main thread, when the
   // resource load has been cancelled.
   virtual void LoadAborted() = 0;
 
   // Called by the video decoder object, on the main thread,