Skip to content

Commit

Permalink
[GStreamer][MediaStream] Reduce usage of the player's m_isPaused vari…
Browse files Browse the repository at this point in the history
…able

https://bugs.webkit.org/show_bug.cgi?id=278983

Reviewed by Xabier Rodriguez-Calvar.

Use the paused() method to know if the newly added audio track should start or not. The m_isPaused
variable is confusing, see also bug #260385.

Covered by fast/mediastream/play-newly-added-audio-track.html

* Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
(WebCore::MediaPlayerPrivateGStreamer::paused const):
(WebCore::MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks):
(WebCore::MediaPlayerPrivateGStreamer::updateStates):

Canonical link: https://commits.webkit.org/283144@main
  • Loading branch information
philn committed Sep 4, 2024
1 parent fe6870e commit 667de7f
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ bool MediaPlayerPrivateGStreamer::paused() const
// For debug mode (either GStreamer of WebKit) we make some extra check to ensure there is no desynchronization
// between pipeline and player. In the case of media stream, we just return the result of the pipeline as there are
// nuances regarding the prerolling creating some regressions in the tests.
#if !defined(GST_DISABLE_GST_DEBUG) || !defined(NDEBUG) || (defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM)
#if !defined(GST_DISABLE_GST_DEBUG) || !defined(NDEBUG) || ENABLE(MEDIA_STREAM)
GstState state, pending;
auto stateChange = gst_element_get_state(m_pipeline.get(), &state, &pending, 0);
bool isPipelinePaused = state <= GST_STATE_PAUSED;
Expand Down Expand Up @@ -1767,7 +1767,7 @@ void MediaPlayerPrivateGStreamer::configureMediaStreamAudioTracks()
{
#if ENABLE(MEDIA_STREAM)
if (WEBKIT_IS_MEDIA_STREAM_SRC(m_source.get()))
webkitMediaStreamSrcConfigureAudioTracks(WEBKIT_MEDIA_STREAM_SRC(m_source.get()), volume(), isMuted(), !m_isPaused);
webkitMediaStreamSrcConfigureAudioTracks(WEBKIT_MEDIA_STREAM_SRC(m_source.get()), volume(), isMuted(), !paused());
#endif
}

Expand Down Expand Up @@ -2524,7 +2524,6 @@ void MediaPlayerPrivateGStreamer::updateStates()

MediaPlayer::NetworkState oldNetworkState = m_networkState;
MediaPlayer::ReadyState oldReadyState = m_readyState;
bool oldIsPaused = m_isPaused;
GstState pending, state;
bool stateReallyChanged = false;
RefPtr player = m_player.get();
Expand Down Expand Up @@ -2713,9 +2712,6 @@ void MediaPlayerPrivateGStreamer::updateStates()
} else if (m_isSeeking && !(state == GST_STATE_PLAYING && pending == GST_STATE_PAUSED))
finishSeek();
}

if (oldIsPaused != m_isPaused)
configureMediaStreamAudioTracks();
}

void MediaPlayerPrivateGStreamer::mediaLocationChanged(GstMessage* message)
Expand Down

0 comments on commit 667de7f

Please sign in to comment.