Bug 1343161 - MediaDecoderOwner::DecodeWarning and HTMLMediaElement implementation - r?jya
Similar to DecodeError, except we allow decoding to continue.
MozReview-Commit-ID: FN9m03o6GXV
--- 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,