Skip to content

Commit 49b30bf

Browse files
emutavchimarcin-mielczarczyk-red
authored andcommitted
[GStreamer] change network state to idle when delaying the load
https://bugs.webkit.org/show_bug.cgi?id=305473 Reviewed by Xabier Rodriguez-Calvar. Sometimes applications create a <video> tag with 'preload="none"' and then remove the element from the DOM without ever starting playback. This results in the video element being leaked, because HTMLMediaElement::virtualHasPendingActivity() retains the element while its network state is still "Loading". See: WebPlatformForEmbedded#1594 This patch keeps the default behaviour of changing the NetworkState to "Loading", except in the case of a delayed load (the case triggered by preload="none"), in which it's set to Idle and therefore allowing the full destruction of the video element. Original author: Eugene Mutavchi <Ievgen_Mutavchi@comcast.com> * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::load): Reset NetworkState to Idle in case of delayed load. Set to Loading otherwise. Canonical link: https://commits.webkit.org/305578@main
1 parent 0fa881b commit 49b30bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ void MediaPlayerPrivateGStreamer::load(const String& urlString)
372372

373373
// Reset network and ready states. Those will be set properly once
374374
// the pipeline pre-rolled.
375-
m_networkState = MediaPlayer::NetworkState::Loading;
375+
m_networkState = m_isDelayingLoad ? MediaPlayer::NetworkState::Idle : MediaPlayer::NetworkState::Loading;
376376
m_player->networkStateChanged();
377377
m_readyState = MediaPlayer::ReadyState::HaveNothing;
378378
m_player->readyStateChanged();

0 commit comments

Comments
 (0)