Bug 1296531 - Remove MediaStream blocking logic from HTMLMediaElement. r?jesup
MediaStreamGraph only implements the blocking notifications for SourceMediaStreams,
but the MediaStream that gets attached as srcObject on a media element is always
a TrackUnionStream. Hence, this code is unused and can be removed.
MozReview-Commit-ID: 6DKtCGNsZec
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -4887,17 +4887,16 @@ HTMLMediaElement::FinishDecoderSetup(Med
class HTMLMediaElement::StreamListener : public MediaStreamListener,
public WatchTarget
{
public:
StreamListener(HTMLMediaElement* aElement, const char* aName) :
WatchTarget(aName),
mElement(aElement),
mHaveCurrentData(false),
- mBlocked(false),
mFinished(false),
mMutex(aName),
mPendingNotifyOutput(false)
{}
void Forget()
{
mElement = nullptr;
NotifyWatchers();
@@ -4905,31 +4904,19 @@ public:
// Main thread
MediaDecoderOwner::NextFrameStatus NextFrameStatus()
{
if (!mElement || !mHaveCurrentData || mFinished) {
return MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
}
- return mBlocked
- ? MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE_BUFFERING
- : MediaDecoderOwner::NEXT_FRAME_AVAILABLE;
- }
-
- void DoNotifyBlocked()
- {
- mBlocked = true;
- NotifyWatchers();
- }
- void DoNotifyUnblocked()
- {
- mBlocked = false;
- NotifyWatchers();
- }
+ return MediaDecoderOwner::NEXT_FRAME_AVAILABLE;
+ }
+
void DoNotifyOutput()
{
{
MutexAutoLock lock(mMutex);
mPendingNotifyOutput = false;
}
if (mElement && mHaveCurrentData) {
RefPtr<HTMLMediaElement> kungFuDeathGrip = mElement;
@@ -4944,32 +4931,16 @@ public:
kungFuDeathGrip->FirstFrameLoaded();
}
NotifyWatchers();
DoNotifyOutput();
}
// These notifications run on the media graph thread so we need to
// dispatch events to the main thread.
- virtual void NotifyBlockingChanged(MediaStreamGraph* aGraph, Blocking aBlocked) override
- {
- nsCOMPtr<nsIRunnable> event;
- if (aBlocked == BLOCKED) {
- event = NewRunnableMethod(
- "dom::HTMLMediaElement::StreamListener::DoNotifyBlocked",
- this,
- &StreamListener::DoNotifyBlocked);
- } else {
- event = NewRunnableMethod(
- "dom::HTMLMediaElement::StreamListener::DoNotifyUnblocked",
- this,
- &StreamListener::DoNotifyUnblocked);
- }
- aGraph->DispatchToMainThreadAfterStreamStateUpdate(event.forget());
- }
virtual void NotifyHasCurrentData(MediaStreamGraph* aGraph) override
{
MutexAutoLock lock(mMutex);
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
NewRunnableMethod(
"dom::HTMLMediaElement::StreamListener::DoNotifyHaveCurrentData",
this,
&StreamListener::DoNotifyHaveCurrentData));
@@ -4986,17 +4957,16 @@ public:
this,
&StreamListener::DoNotifyOutput));
}
private:
// These fields may only be accessed on the main thread
HTMLMediaElement* mElement;
bool mHaveCurrentData;
- bool mBlocked;
bool mFinished;
// mMutex protects the fields below; they can be accessed on any thread
Mutex mMutex;
bool mPendingNotifyOutput;
};
class HTMLMediaElement::MediaStreamTracksAvailableCallback: