Skip to content

Commit b371bc5

Browse files
suresh-khurdiya-epameocanha
authored andcommitted
[GStreamer] Setting playbackRate=0 does not pause video for progressive video playback
https://bugs.webkit.org/show_bug.cgi?id=267601 Reviewed by Philippe Normand. Setting playbackRate=0 on a regular video doesn't pause the playback. Also, setting playbackRate=1 (or any other value) on a paused video doesn't resume the playback. See: #1272 There's an m_playbackRatePausedState attribute in the curent code, but it only keeps track of the desired state to be reported to the upper layers and also about if the video should be paused/unpaused because of buffering. It's not working in practice to make the playbackRate changes done from JavaScript effective in the pipeline. This patch adds code to update the pipeline state depending on that already existing desired state. Original author: suresh-khurdiya-epam <skhurdiya.contractor@libertyglobal.com> * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::setRate): Pause/unpause the pipeline according to the state of playbackRate. Canonical link: https://commits.webkit.org/273125@main
1 parent d328098 commit b371bc5

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,13 @@ void MediaPlayerPrivateGStreamer::setRate(float rate)
640640
m_playbackRatePausedState = PlaybackRatePausedState::RatePaused;
641641
updateStates();
642642
}
643+
if (m_currentState == GST_STATE_PLAYING && !m_playbackRate
644+
&& m_playbackRatePausedState != PlaybackRatePausedState::RatePaused) {
645+
GST_INFO_OBJECT(pipeline(), "Pausing stream because of zero playback rate in setRate");
646+
m_playbackRatePausedState = PlaybackRatePausedState::RatePaused;
647+
changePipelineState(GST_STATE_PAUSED);
648+
updatePlaybackRate();
649+
}
643650
return;
644651
} else if (m_playbackRatePausedState == PlaybackRatePausedState::RatePaused) {
645652
m_playbackRatePausedState = PlaybackRatePausedState::ShouldMoveToPlaying;
@@ -651,7 +658,12 @@ void MediaPlayerPrivateGStreamer::setRate(float rate)
651658
if ((state != GST_STATE_PLAYING && state != GST_STATE_PAUSED)
652659
|| (pending == GST_STATE_PAUSED))
653660
return;
654-
661+
if (m_currentState == GST_STATE_PAUSED && m_playbackRate
662+
&& m_playbackRatePausedState != PlaybackRatePausedState::Playing) {
663+
m_playbackRatePausedState = PlaybackRatePausedState::Playing;
664+
GST_INFO_OBJECT(pipeline(), "[Buffering] Restarting playback (because of resuming from zero playback rate) in setRate");
665+
changePipelineState(GST_STATE_PLAYING);
666+
}
655667
updatePlaybackRate();
656668
}
657669

0 commit comments

Comments
 (0)