Skip to content

Commit

Permalink
Revert "Cherry-pick 276798@main (f91aeb9). https://bugs.webkit.org/sh…
Browse files Browse the repository at this point in the history
  • Loading branch information
mcatanzaro committed May 18, 2024
1 parent 5a640a0 commit c6f625d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 80 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ void MediaPlayerPrivateGStreamer::load(const String& urlString)
m_fillTimer.stop();

ASSERT(m_pipeline);
setPlaybinURL(url);
setVisibleInViewport(player->isVisibleInViewport());
setPlaybinURL(url);

GST_DEBUG_OBJECT(pipeline(), "preload: %s", convertEnumerationToString(m_preload).utf8().data());
if (m_preload == MediaPlayer::Preload::None && !isMediaSource()) {
Expand Down Expand Up @@ -4027,18 +4027,10 @@ void MediaPlayerPrivateGStreamer::setVisibleInViewport(bool isVisible)
if (!isVisible) {
GstState currentState;
gst_element_get_state(m_pipeline.get(), &currentState, nullptr, 0);
// WebKitMediaSrc cannot properly handle PAUSED -> READY -> PAUSED currently, so we have to avoid transitioning
// back to READY when the player becomes visible.
GstState minimumState = isMediaSource() ? GST_STATE_PAUSED : GST_STATE_READY;
if (currentState >= minimumState)
if (currentState > GST_STATE_NULL)
m_invisiblePlayerState = currentState;
m_isVisibleInViewport = false;
// Avoid setting the pipeline to PAUSED unless the playbin URL has already been set,
// otherwise it will fail, and may leave the pipeline stuck on READY with PAUSE pending.
if (!m_url.isValid())
return;
[[maybe_unused]] auto setStateResult = gst_element_set_state(m_pipeline.get(), GST_STATE_PAUSED);
ASSERT(setStateResult != GST_STATE_CHANGE_FAILURE);
gst_element_set_state(m_pipeline.get(), GST_STATE_PAUSED);
} else {
m_isVisibleInViewport = true;
if (m_invisiblePlayerState != GST_STATE_VOID_PENDING)
Expand Down

0 comments on commit c6f625d

Please sign in to comment.