Repository navigation
media: Restore paused video frame on reveal after conceal suspend - #13360
andrewsavage1 merged 1 commit into
Conversation
|
🤖 Gemini Suggested Commit Message💡 Pro Tips for a Better Commit Message:
|
There was a problem hiding this comment.
Code Review
This pull request introduces Cobalt-specific logic to restore the first video frame after resuming playback from a suspended state. It updates WebMediaPlayerImpl to track first-frame needs when suspended and schedules a repaint via OnFirstFrameAfterResume upon resuming. The review feedback suggests simplifying the complex callback binding chain in MaybeRestoreFirstFrameAfterResume by reducing redundant conversions between Blink and Chromium callback types.
When Cobalt conceals the application, SuspendForFrameClosed() is invoked and tears down the underlying SbPlayer, clearing the hardware video plane. Upon reveal (OnPageShown), if the video was paused with video tracks, UpdatePlayState_ComputePlayState() computes can_stay_suspended = true because pipeline_controller_->IsSuspended() is still true, preventing the pipeline from resuming and leaving a black screen. To fix this with minimal upstream impact, when OnPageShown() is called after a frame-closed suspension on a paused video player: 1. Clear any stale flag on the delegate so idle_suspended does not trigger. 2. Call SetSuspendState(false) to resume the pipeline, which immediately flips pipeline_controller_->IsSuspended() to false so the subsequent UpdatePlayState() call keeps the pipeline resumed and decodes/renders the paused video frame. Bug: 573530009 TAG=agy CONV=cece9c0a-9ef6-4434-bffa-ac7e3bff2f8d
8d77532 to
a1a8d9c
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces Cobalt-specific logic within 'WebMediaPlayerImpl::OnPageShown' to clear the stale flag and update the suspend state when the player is paused, has video, and was suspended due to a closed frame. The review feedback highlights a potential null pointer dereference on 'delegate_' and suggests adding a null check before invoking 'ClearStaleFlag'.
yell0wd0g
left a comment
There was a problem hiding this comment.
RS LGTM since it only affects WMP and it has been approved by a media dev.
…ter conceal suspend Refer to original PR: #13360 When Cobalt conceals the application, `SuspendForFrameClosed()` is invoked and tears down the underlying `SbPlayer`, clearing the hardware video plane. Upon reveal (`OnPageShown`), if the video was paused with video tracks, `UpdatePlayState_ComputePlayState()` computes `can_stay_suspended = true` because `pipeline_controller_->IsSuspended()` is still `true`, preventing the pipeline from resuming and leaving a black screen. To fix this with minimal upstream impact, when `OnPageShown()` is called after a frame-closed suspension on a paused video player: 1. Clear any stale flag on the delegate (`delegate_->ClearStaleFlag(delegate_id_)`) so `idle_suspended` does not trigger. 2. Call `SetSuspendState(false)` to resume the pipeline, which immediately flips `pipeline_controller_->IsSuspended()` to `false` so the subsequent `UpdatePlayState()` call keeps the pipeline resumed and decodes/renders the paused video frame. Bug: 573530009 TAG=agy CONV=cece9c0a-9ef6-4434-bffa-ac7e3bff2f8d (cherry picked from commit 3ed873d)
…ter conceal suspend Refer to original PR: #13360 When Cobalt conceals the application, `SuspendForFrameClosed()` is invoked and tears down the underlying `SbPlayer`, clearing the hardware video plane. Upon reveal (`OnPageShown`), if the video was paused with video tracks, `UpdatePlayState_ComputePlayState()` computes `can_stay_suspended = true` because `pipeline_controller_->IsSuspended()` is still `true`, preventing the pipeline from resuming and leaving a black screen. To fix this with minimal upstream impact, when `OnPageShown()` is called after a frame-closed suspension on a paused video player: 1. Clear any stale flag on the delegate (`delegate_->ClearStaleFlag(delegate_id_)`) so `idle_suspended` does not trigger. 2. Call `SetSuspendState(false)` to resume the pipeline, which immediately flips `pipeline_controller_->IsSuspended()` to `false` so the subsequent `UpdatePlayState()` call keeps the pipeline resumed and decodes/renders the paused video frame. Bug: 573530009 TAG=agy CONV=cece9c0a-9ef6-4434-bffa-ac7e3bff2f8d (cherry picked from commit 3ed873d)
…reveal after conceal suspend Refer to original PR: #13360 When Cobalt conceals the application, `SuspendForFrameClosed()` is invoked and tears down the underlying `SbPlayer`, clearing the hardware video plane. Upon reveal (`OnPageShown`), if the video was paused with video tracks, `UpdatePlayState_ComputePlayState()` computes `can_stay_suspended = true` because `pipeline_controller_->IsSuspended()` is still `true`, preventing the pipeline from resuming and leaving a black screen. To fix this with minimal upstream impact, when `OnPageShown()` is called after a frame-closed suspension on a paused video player: 1. Clear any stale flag on the delegate (`delegate_->ClearStaleFlag(delegate_id_)`) so `idle_suspended` does not trigger. 2. Call `SetSuspendState(false)` to resume the pipeline, which immediately flips `pipeline_controller_->IsSuspended()` to `false` so the subsequent `UpdatePlayState()` call keeps the pipeline resumed and decodes/renders the paused video frame. Bug: 573530009 TAG=agy CONV=cece9c0a-9ef6-4434-bffa-ac7e3bff2f8d (cherry picked from commit 3ed873d)
…n reveal after conceal suspend (#13628) Automated cherry-pick roll to staging. Original pull requests: - #13360 CONFLICTED files: ``` third_party/blink/renderer/platform/media/web_media_player_impl.cc ```⚠️ This PR has conflicts that must be resolved manually (don't forget to update the `.github/AUTOROLL` file). Use the following commands to checkout the branch locally and resolve the conflicts in a separate commit: ```bash gh pr checkout <pull_request_number> -R youtube/cobalt # Resolve conflicts and update .github/AUTOROLL then git add <resolved_files> # Copy CONFLICTED commit's message and metadata # Replace CONFLICTED in title with RESOLVED git commit -c <conflicted_sha> git push origin autoroll-main-to-staging ``` --------- Co-authored-by: Andrew Savage <andrewsavage@google.com>
When Cobalt conceals the application,
SuspendForFrameClosed()is invoked and tears down the underlyingSbPlayer, clearing the hardware video plane. Upon reveal (OnPageShown), if the video was paused with video tracks,UpdatePlayState_ComputePlayState()computescan_stay_suspended = truebecausepipeline_controller_->IsSuspended()is stilltrue, preventing the pipeline from resuming and leaving a black screen.To fix this with minimal upstream impact, when
OnPageShown()is called after a frame-closed suspension on a paused video player:delegate_->ClearStaleFlag(delegate_id_)) soidle_suspendeddoes not trigger.SetSuspendState(false)to resume the pipeline, which immediately flipspipeline_controller_->IsSuspended()tofalseso the subsequentUpdatePlayState()call keeps the pipeline resumed and decodes/renders the paused video frame.Bug: 573530009
TAG=agy
CONV=cece9c0a-9ef6-4434-bffa-ac7e3bff2f8d