diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index db5b9ed91596..ac53b7e30da0 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -1042,6 +1042,13 @@ MediaDecoder::IsEndedOrShutdown() const return IsEnded() || mPlayState == PLAY_STATE_SHUTDOWN; } +bool +MediaDecoder::OwnerHasError() const +{ + MOZ_ASSERT(NS_IsMainThread()); + return mShuttingDown || mOwner->HasError(); +} + bool MediaDecoder::IsEnded() const { diff --git a/dom/media/MediaDecoder.h b/dom/media/MediaDecoder.h index 0542703cca78..acaeea4d5e51 100644 --- a/dom/media/MediaDecoder.h +++ b/dom/media/MediaDecoder.h @@ -234,6 +234,10 @@ public: // Call on the main thread only. virtual bool IsEndedOrShutdown() const; + // Return true if the MediaDecoderOwner's error attribute is not null. + // If the MediaDecoder is shutting down, OwnerHasError will return true. + bool OwnerHasError() const; + protected: // Updates the media duration. This is called while the media is being // played, calls before the media has reached loaded metadata are ignored.