Bug 1246521: P2. Add MediaDecoder::OwnerHasError method. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 08 Feb 2016 15:28:15 +1100
changeset 283428 770d1bb1ca0cc7256ebeac784b64a3c7270eae73
parent 283427 de6c0f937e9fb8afaf90acb9f739ce412a65d0f5
child 283429 02c902f1919052fd4a9bf0f982a874f5cee440e5
push id29982
push usercbook@mozilla.com
push dateMon, 08 Feb 2016 10:57:27 +0000
treeherdermozilla-central@ac338559876d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1246521
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1246521: P2. Add MediaDecoder::OwnerHasError method. r=gerald
dom/media/MediaDecoder.cpp
dom/media/MediaDecoder.h
--- a/dom/media/MediaDecoder.cpp
+++ b/dom/media/MediaDecoder.cpp
@@ -1038,16 +1038,23 @@ MediaDecoder::IsSeeking() const
 bool
 MediaDecoder::IsEndedOrShutdown() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   return IsEnded() || mPlayState == PLAY_STATE_SHUTDOWN;
 }
 
 bool
+MediaDecoder::OwnerHasError() const
+{
+  MOZ_ASSERT(NS_IsMainThread());
+  return mShuttingDown || mOwner->HasError();
+}
+
+bool
 MediaDecoder::IsEnded() const
 {
   MOZ_ASSERT(NS_IsMainThread());
   return mPlayState == PLAY_STATE_ENDED ||
          (mWasEndedWhenEnteredDormant && (mPlayState != PLAY_STATE_SHUTDOWN));
 }
 
 void
--- a/dom/media/MediaDecoder.h
+++ b/dom/media/MediaDecoder.h
@@ -229,16 +229,20 @@ public:
   // Call on the main thread only.
   virtual bool IsSeeking() const;
 
   // Return true if the decoder has reached the end of playback or the decoder
   // has shutdown.
   // 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.
   // The duration is assumed to be an estimate, and so a degree of
   // instability is expected; if the incoming duration is not significantly
   // different from the existing duration, the change request is ignored.
   // If the incoming duration is significantly different, the duration is
   // changed, this causes a durationchanged event to fire to the media