From 12178eb498375da50ab87229d5b9862ea3f70698 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sun, 3 Jul 2011 18:26:00 -0700 Subject: [PATCH] Back out 29ec386d969f and ed18b0cca283 (bug 462959) for a very frequent assertion loop in test_played.html --- .../html/content/public/nsHTMLMediaElement.h | 7 - .../html/content/src/nsHTMLMediaElement.cpp | 57 +---- content/html/content/src/nsTimeRanges.cpp | 25 -- content/html/content/src/nsTimeRanges.h | 18 -- content/media/test/Makefile.in | 1 - content/media/test/manifest.js | 8 - content/media/test/test_played.html | 231 ------------------ .../html/nsIDOMHTMLAudioElement.idl | 2 +- .../html/nsIDOMHTMLMediaElement.idl | 3 +- .../html/nsIDOMHTMLVideoElement.idl | 6 +- 10 files changed, 7 insertions(+), 351 deletions(-) delete mode 100644 content/media/test/test_played.html diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h index 45d31997e0b..1b2694ac9af 100644 --- a/content/html/content/public/nsHTMLMediaElement.h +++ b/content/html/content/public/nsHTMLMediaElement.h @@ -50,7 +50,6 @@ #include "nsIObserver.h" #include "ImageLayers.h" #include "nsAudioStream.h" -#include "nsTimeRanges.h" // Define to output information on decoding and painting framerate /* #define DEBUG_FRAME_RATE 1 */ @@ -625,12 +624,6 @@ protected: // a media and element same-origin check. PRBool mAllowAudioData; - // Range of time played. - nsTimeRanges mPlayed; - - // Temporary variable for storing a time, when the stream starts to play - double mCurrentPlayRangeStart; - // If true then we have begun downloading the media content. // Set to false when completed, or not yet started. PRPackedBool mBegun; diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp index 45e421227ba..cf8a2ec2065 100644 --- a/content/html/content/src/nsHTMLMediaElement.cpp +++ b/content/html/content/src/nsHTMLMediaElement.cpp @@ -39,6 +39,7 @@ #include "nsIDOMHTMLMediaElement.h" #include "nsIDOMHTMLSourceElement.h" #include "nsHTMLMediaElement.h" +#include "nsTimeRanges.h" #include "nsGenericHTMLElement.h" #include "nsPresContext.h" #include "nsIPresShell.h" @@ -1091,16 +1092,6 @@ NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(double aCurrentTime) { StopSuspendingAfterFirstFrame(); - if (mCurrentPlayRangeStart != -1) { - double oldCurrentTime = 0; - GetCurrentTime(&oldCurrentTime); - LOG(PR_LOG_DEBUG, ("Adding a range: [%f, %f]", mCurrentPlayRangeStart, oldCurrentTime)); - // Multiple seek without playing - if (mCurrentPlayRangeStart != oldCurrentTime) { - mPlayed.Add(mCurrentPlayRangeStart, oldCurrentTime); - } - } - if (!mDecoder) { LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: no decoder", this, aCurrentTime)); return NS_ERROR_DOM_INVALID_STATE_ERR; @@ -1130,9 +1121,6 @@ NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(double aCurrentTime) LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) starting seek", this, aCurrentTime)); nsresult rv = mDecoder->Seek(clampedTime); - // Start a new range at position we seeked to - mCurrentPlayRangeStart = clampedTime; - // We changed whether we're seeking so we need to AddRemoveSelfReference AddRemoveSelfReference(); @@ -1154,35 +1142,6 @@ NS_IMETHODIMP nsHTMLMediaElement::GetPaused(PRBool *aPaused) return NS_OK; } -/* readonly attribute nsIDOMHTMLTimeRanges played; */ -NS_IMETHODIMP nsHTMLMediaElement::GetPlayed(nsIDOMTimeRanges** aPlayed) -{ - nsRefPtr ranges = new nsTimeRanges(); - - PRUint32 timeRangeCount = 0; - mPlayed.GetLength(&timeRangeCount); - for (PRUint32 i = 0; i < timeRangeCount; i++) { - double begin; - double end; - mPlayed.Start(i, &begin); - mPlayed.End(i, &end); - ranges->Add(begin, end); - } - - if (mCurrentPlayRangeStart != -1.0) { - double now = 0.0; - GetCurrentTime(&now); - if (mCurrentPlayRangeStart != now) { - ranges->Add(mCurrentPlayRangeStart, now); - } - } - - ranges->Normalize(); - - ranges.forget(aPlayed); - return NS_OK; -} - /* void pause (); */ NS_IMETHODIMP nsHTMLMediaElement::Pause() { @@ -1321,7 +1280,6 @@ nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed aNodeInfo, mMediaSize(-1,-1), mLastCurrentTime(0.0), mAllowAudioData(PR_FALSE), - mCurrentPlayRangeStart(-1.0), mBegun(PR_FALSE), mLoadedFirstFrame(PR_FALSE), mAutoplaying(PR_TRUE), @@ -1422,10 +1380,6 @@ NS_IMETHODIMP nsHTMLMediaElement::Play() } } - if (mCurrentPlayRangeStart == -1.0) { - GetCurrentTime(&mCurrentPlayRangeStart); - } - // TODO: If the playback has ended, then the user agent must set // seek to the effective start. // TODO: The playback rate must be set to the default playback rate. @@ -2080,13 +2034,6 @@ void nsHTMLMediaElement::PlaybackEnded() // We changed the state of IsPlaybackEnded which can affect AddRemoveSelfReference AddRemoveSelfReference(); - double end = 0.0; - GetCurrentTime(&end); - if (mCurrentPlayRangeStart != end) { - mPlayed.Add(mCurrentPlayRangeStart, end); - } - mCurrentPlayRangeStart = -1.0; - FireTimeUpdate(PR_FALSE); DispatchAsyncEvent(NS_LITERAL_STRING("ended")); } @@ -2502,7 +2449,7 @@ void nsHTMLMediaElement::NotifyAddedSource() } // A load was paused in the resource selection algorithm, waiting for - // a new source child to be added, resume the resource selection algorithm. + // a new source child to be added, resume the resource selction algorithm. if (mLoadWaitStatus == WAITING_FOR_SOURCE) { QueueLoadFromSourceTask(); } diff --git a/content/html/content/src/nsTimeRanges.cpp b/content/html/content/src/nsTimeRanges.cpp index 90367f53a7f..70c3e1889f1 100644 --- a/content/html/content/src/nsTimeRanges.cpp +++ b/content/html/content/src/nsTimeRanges.cpp @@ -85,28 +85,3 @@ void nsTimeRanges::Add(double aStart, double aEnd) { mRanges.AppendElement(TimeRange(aStart,aEnd)); } - -void -nsTimeRanges::Normalize() { - if (mRanges.Length() <= 1) { - return; - } - nsAutoTArray normalized; - - mRanges.Sort(CompareTimeRanges()); - - // This merges the intervals - TimeRange current(mRanges[0]); - for (PRUint32 i = 1; i < mRanges.Length(); i++) { - if (current.mEnd >= mRanges[i].mStart) { - current.mEnd = NS_MAX(current.mEnd, mRanges[i].mEnd); - } else { - normalized.AppendElement(current); - current = mRanges[i]; - } - } - - normalized.AppendElement(current); - - mRanges = normalized; -} diff --git a/content/html/content/src/nsTimeRanges.h b/content/html/content/src/nsTimeRanges.h index 59678a0a4e7..172cadb5b85 100644 --- a/content/html/content/src/nsTimeRanges.h +++ b/content/html/content/src/nsTimeRanges.h @@ -55,9 +55,6 @@ public: void Add(double aStart, double aEnd); - // See . - void Normalize(); - private: struct TimeRange { @@ -68,21 +65,6 @@ private: double mEnd; }; - struct CompareTimeRanges - { - PRBool Equals(const TimeRange& tr1, const TimeRange& tr2) const - { - return tr1.mStart == tr2.mStart && tr1.mEnd == tr2.mEnd; - } - - // Here, we aim at time range normalization. That why we order only by start - // time, since the ranges can overlap. - PRBool LessThan(const TimeRange& tr1, const TimeRange& tr2) const - { - return tr1.mStart < tr2.mStart; - } - }; - nsAutoTArray mRanges; }; diff --git a/content/media/test/Makefile.in b/content/media/test/Makefile.in index b26441e1387..a538b7550a0 100644 --- a/content/media/test/Makefile.in +++ b/content/media/test/Makefile.in @@ -126,7 +126,6 @@ _TEST_FILES = \ test_paused_after_ended.html \ test_play_events.html \ test_play_events_2.html \ - test_played.html \ test_playback.html \ test_playback_errors.html \ test_preload_actions.html \ diff --git a/content/media/test/manifest.js b/content/media/test/manifest.js index 4870dfe1262..b3238af5eb9 100644 --- a/content/media/test/manifest.js +++ b/content/media/test/manifest.js @@ -23,14 +23,6 @@ var gProgressTests = [ { name:"bogus.duh", type:"bogus/duh" } ]; -// Used by test_played -var gPlayedTests = [ - { name:"big.wav", type:"audio/x-wav", duration:9.0, size:102444 }, - { name:"sound.ogg", type:"audio/ogg", duration:4.0, size:2603 }, - { name:"seek.ogv", type:"video/ogg", duration:3.966, size:285310 }, - { name:"seek.webm", type:"video/webm", duration:3.966 } -]; - // Used by test_mozLoadFrom. Need one test file per decoder backend, plus // anything for testing clone-specific bugs. var gCloneTests = gSmallTests.concat([ diff --git a/content/media/test/test_played.html b/content/media/test/test_played.html deleted file mode 100644 index edad877719b..00000000000 --- a/content/media/test/test_played.html +++ /dev/null @@ -1,231 +0,0 @@ - - - -Test played member for media elements - - - - - - -
-
-
- - diff --git a/dom/interfaces/html/nsIDOMHTMLAudioElement.idl b/dom/interfaces/html/nsIDOMHTMLAudioElement.idl index 6c4805d081f..a0f44339e58 100644 --- a/dom/interfaces/html/nsIDOMHTMLAudioElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLAudioElement.idl @@ -52,7 +52,7 @@ * @status UNDER_DEVELOPMENT */ -[scriptable, uuid(1f2437f1-6037-40c4-bfb6-105c6c60f0ca)] +[scriptable, uuid(f0d4977c-9632-4fab-bc9b-91c250a6ef96)] interface nsIDOMHTMLAudioElement : nsIDOMHTMLMediaElement { // Setup the audio stream for writing diff --git a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl index 8181aeb768c..dcbcad76c3a 100644 --- a/dom/interfaces/html/nsIDOMHTMLMediaElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLMediaElement.idl @@ -57,7 +57,7 @@ #endif %} -[scriptable, uuid(c8a5f714-97de-4e2c-8394-2397870224bb)] +[scriptable, uuid(d8213322-46d8-47ca-a15c-2abae47ddfde)] interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement { // error state @@ -89,7 +89,6 @@ interface nsIDOMHTMLMediaElement : nsIDOMHTMLElement attribute double currentTime; readonly attribute double duration; readonly attribute boolean paused; - readonly attribute nsIDOMTimeRanges played; readonly attribute boolean ended; readonly attribute boolean mozAutoplayEnabled; attribute boolean autoplay; diff --git a/dom/interfaces/html/nsIDOMHTMLVideoElement.idl b/dom/interfaces/html/nsIDOMHTMLVideoElement.idl index d4b0fe60b06..ac0f5d07e79 100644 --- a/dom/interfaces/html/nsIDOMHTMLVideoElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLVideoElement.idl @@ -48,15 +48,15 @@ * @status UNDER_DEVELOPMENT */ -[scriptable, uuid(169f0ff1-511a-453d-86b6-346c1e936122)] +[scriptable, uuid(00c757ec-db7b-477e-95cd-b2a03b0f8634)] interface nsIDOMHTMLVideoElement : nsIDOMHTMLMediaElement { - attribute long width; + attribute long width; attribute long height; readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; attribute DOMString poster; - + // A count of the number of video frames that have demuxed from the media // resource. If we were playing perfectly, we'd be able to paint this many // frames.