Skip to content

Commit

Permalink
Prevent false-positive "stalled" event iff MSE used (WebPlatformForEm…
Browse files Browse the repository at this point in the history
…bedded#711)

"progress" and "stalled" events make no sense in context of MSE:
w3c/media-source#88
and hence they will likely be removed soon:
https://w3c.github.io/media-source/#h-note-19
  • Loading branch information
Scony authored and Pawel Lampe committed Aug 22, 2022
1 parent 93f46bd commit eaa4221
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/WebCore/html/HTMLMediaElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2885,6 +2885,8 @@ void HTMLMediaElement::progressEventTimerFired()
ASSERT(m_player);
if (m_networkState != NETWORK_LOADING)
return;
if (!m_player->supportsProgressMonitoring())
return;

MonotonicTime time = MonotonicTime::now();
Seconds timedelta = time - m_previousProgressTime;
Expand Down
5 changes: 5 additions & 0 deletions Source/WebCore/platform/graphics/MediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ bool MediaPlayer::supportsScanning() const
return m_private->supportsScanning();
}

bool MediaPlayer::supportsProgressMonitoring() const
{
return m_private->supportsProgressMonitoring();
}

bool MediaPlayer::requiresImmediateCompositing() const
{
return m_private->requiresImmediateCompositing();
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/graphics/MediaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ class WEBCORE_EXPORT MediaPlayer : public MediaPlayerEnums, public RefCounted<Me
bool supportsPictureInPicture() const;
bool supportsFullscreen() const;
bool supportsScanning() const;
bool supportsProgressMonitoring() const;
bool canSaveMediaData() const;
bool requiresImmediateCompositing() const;
bool doesHaveAttribute(const AtomString&, AtomString* value = nullptr) const;
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/graphics/MediaPlayerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class MediaPlayerPrivateInterface {
virtual bool supportsPictureInPicture() const { return false; }
virtual bool supportsFullscreen() const { return false; }
virtual bool supportsScanning() const { return false; }
virtual bool supportsProgressMonitoring() const { return true; }
virtual bool requiresImmediateCompositing() const { return false; }

virtual bool canSaveMediaData() const { return false; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ class MediaPlayerPrivateGStreamerMSE : public MediaPlayerPrivateGStreamer {

void sourceSetup(GstElement*) override;

// return false to avoid false-positive "stalled" event - it should be soon addressed in the spec
// see: https://github.com/w3c/media-source/issues/88
// see: https://w3c.github.io/media-source/#h-note-19
bool supportsProgressMonitoring() const override { return false; }

void setReadyState(MediaPlayer::ReadyState);
void waitForSeekCompleted();
void seekCompleted();
Expand Down

0 comments on commit eaa4221

Please sign in to comment.