Skip to content

media: Report seek time from StarboardRenderer until SbPlayer presents - #13721

Merged
andrewsavage1 merged 2 commits into
youtube:mainfrom
andrewsavage1:fix-seek-stale-media-time
Nov 3, 2026
Merged

andrewsavage1 merged 2 commits into
youtube:mainfrom
andrewsavage1:fix-seek-stale-media-time

Conversation

@andrewsavage1

@andrewsavage1 andrewsavage1 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

After StartPlayingFrom() calls SbPlayerSeek(), SbPlayerGetInfo() may keep returning the pre-seek position until the platform completes the seek asynchronously. PipelineImpl only substitutes the seek time until OnSeekDone, which is posted right after StartPlayingFrom(), and afterwards clamps media time so that it never goes backwards. A stale pre-seek value therefore latches into PipelineImpl::last_media_time_, freezing currentTime after a backwards seek for the length of the seek. The web app then shows buffering and eventually reloads the player.

Cobalt 25's SbPlayerPipeline::GetMediaTime() returned the seek time until the SbPlayer reached kSbPlayerStatePresenting. This restores that behavior in StarboardRenderer: while buffering_state_ is BUFFERING_HAVE_NOTHING (from construction or Flush() until the SbPlayer reaches kSbPlayerStatePresenting), GetMediaTime() reports seek_time_.

Testing:

  • Device with an asynchronous SbPlayerSeek() implementation (27.lts build): seeking back 20s while playing froze currentTime for ~20s before the change (logs show SbPlayerGetInfo() returning 41.39s right after StartPlayingFrom(21.38s)), and resumes from the seek target immediately after it. Forward seeks into unbuffered ranges and back-to-back seeks also behave normally.
  • RDK: not affected before or after, as its SbPlayerSeek() records the seek target synchronously.
  • Added StarboardRendererTest.GetMediaTimeReportsSeekTimeUntilPresenting and StarboardRendererTest.GetMediaTimeReportsSeekTimeAfterBackwardSeek, which fail without this change (reporting the pre-seek time instead of 20s). StarboardRendererTest.* and SbPlayerBridge* pass on linux-x64x11 devel.

Bug: 575365692
TAG=agy
CONV=95eeeebe-e64a-4dba-b215-21568808834d

@andrewsavage1
andrewsavage1 requested a review from a team as a code owner October 29, 2026 18:45
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ❌ FAIL Some checks failed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ❌ FAIL Failed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


media: Report seek time until SbPlayer presents

After a seek, SbPlayerGetInfo may continue to return the pre-seek
position until the platform completes the seek asynchronously. Because
PipelineImpl clamps media time to prevent it from moving backwards,
reporting a stale pre-seek value after a backwards seek can cause
currentTime to freeze until the playback position catches up.

This restores behavior from previous Cobalt versions where the seek
target is reported until the SbPlayer reaches a presenting or
end-of-stream state. This prevents UI stalls on platforms that process
seeks asynchronously.

Bug: 575365692

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a mechanism to prevent the media pipeline from clamping and freezing the media time during asynchronous seeks. It does this by reporting the target seek time from GetMediaTime() until the player transitions to a presenting or end-of-stream state, accompanied by a new unit test. The review feedback recommends resetting the is_seek_pending_presenting_ flag during a Flush() operation to avoid returning stale seek times, and suggests limiting the VLOG_IF statement in GetMediaTime() to log only once per seek to prevent log spam.

Comment thread media/starboard/starboard_renderer.cc Resolved
Comment thread media/starboard/starboard_renderer.cc Resolved
Comment thread media/starboard/starboard_renderer.h Resolved
Comment thread media/starboard/starboard_renderer.cc Resolved
Comment thread media/starboard/starboard_renderer.cc Resolved
After StartPlayingFrom() calls SbPlayerSeek(), SbPlayerGetInfo() may keep
returning the pre-seek position until the platform completes the seek
asynchronously. PipelineImpl only substitutes the seek time until
OnSeekDone, which is posted right after StartPlayingFrom(), and afterwards
clamps media time so that it never goes backwards. A stale pre-seek value
therefore latches into PipelineImpl::last_media_time_, freezing
currentTime after a backwards seek for the length of the seek. The web
app then shows buffering and eventually reloads the player.

Cobalt 25's SbPlayerPipeline::GetMediaTime() returned the seek time
until the SbPlayer reached kSbPlayerStatePresenting. Restore that
behavior in StarboardRenderer.

Verified on a 2027 Samsung Tizen TV: seeking back 20s while playing
froze currentTime for ~20s before the change and resumes immediately
after it. RDK is unaffected as its SbPlayerSeek() records the seek
target synchronously. Added
StarboardRendererTest.GetMediaTimeReportsSeekTimeUntilPresenting, which
fails without this change.

Bug: 575365692
TAG=agy
CONV=95eeeebe-e64a-4dba-b215-21568808834d
- Use buffering_state_ == BUFFERING_HAVE_NOTHING instead of a separate
  is_seek_pending_presenting_ flag.
- Remove redundant seek_time_ assignment in StartPlayingFrom().
- Drop per-call VLOG in GetMediaTime().
- Add StarboardRendererTest.GetMediaTimeReportsSeekTimeAfterBackwardSeek.

Bug: 575365692
@andrewsavage1
andrewsavage1 force-pushed the fix-seek-stale-media-time branch from d765f4e to 13d6414 Compare November 3, 2026 21:23
@andrewsavage1
andrewsavage1 merged commit 0fa4078 into youtube:main Nov 3, 2026
739 of 746 checks passed
@andrewsavage1 andrewsavage1 added the cp-27.lts Cherry Pick to the 27.lts branch label Nov 3, 2026
cobalt-github-releaser-bot pushed a commit that referenced this pull request Nov 3, 2026
… until SbPlayer presents

Refer to original PR: #13721

After `StartPlayingFrom()` calls `SbPlayerSeek()`, `SbPlayerGetInfo()`
may keep returning the pre-seek position until the platform completes
the seek asynchronously. `PipelineImpl` only substitutes the seek time
until `OnSeekDone`, which is posted right after `StartPlayingFrom()`,
and afterwards clamps media time so that it never goes backwards. A
stale pre-seek value therefore latches into
`PipelineImpl::last_media_time_`, freezing `currentTime` after a
backwards seek for the length of the seek. The web app then shows
buffering and eventually reloads the player.

Cobalt 25's `SbPlayerPipeline::GetMediaTime()` returned the seek time
until the SbPlayer reached `kSbPlayerStatePresenting`. This restores
that behavior in `StarboardRenderer`: while `buffering_state_` is
`BUFFERING_HAVE_NOTHING` (from construction or `Flush()` until the
SbPlayer reaches `kSbPlayerStatePresenting`), `GetMediaTime()` reports
`seek_time_`.

Testing:
- Device with an asynchronous SbPlayerSeek() implementation (27.lts
build): seeking back 20s while playing froze `currentTime` for ~20s
before the change (logs show `SbPlayerGetInfo()` returning 41.39s right
after `StartPlayingFrom(21.38s)`), and resumes from the seek target
immediately after it. Forward seeks into unbuffered ranges and
back-to-back seeks also behave normally.
- RDK: not affected before or after, as its `SbPlayerSeek()` records the
seek target synchronously.
- Added
`StarboardRendererTest.GetMediaTimeReportsSeekTimeUntilPresenting` and
`StarboardRendererTest.GetMediaTimeReportsSeekTimeAfterBackwardSeek`,
which fail without this change (reporting the pre-seek time instead of
20s). `StarboardRendererTest.*` and `SbPlayerBridge*` pass on
linux-x64x11 devel.

Bug: 575365692
TAG=agy
CONV=95eeeebe-e64a-4dba-b215-21568808834d

(cherry picked from commit 0fa4078)
kjyoun added a commit to kjyoun/cobalt that referenced this pull request Nov 3, 2026
SbPlayer has no rebuffering state. When one stream runs out of data
mid-playback while the other is still buffered (e.g. video starves
while audio is buffered), the media clock keeps advancing on the
remaining stream. StarboardRenderer reported BUFFERING_HAVE_ENOUGH on
kSbPlayerStatePresenting and BUFFERING_HAVE_NOTHING only on Flush(), so
such an underflow was never surfaced: readyState stayed
HAVE_ENOUGH_DATA, no 'waiting' event fired, currentTime kept advancing,
and web apps could not detect the stall. On YouTube this shows up as
frozen video with audio playing and no rebuffering spinner after
switching to a format the network can't sustain (b/578446041).

Behind the new Media.HandlePlaybackUnderflow experimental feature (an
h5vcc setting, off by default):
- PlaybackUnderflowDetector (new) is a pure state machine over the data
  written to the SbPlayer per stream:
  - A stream is starved when less than 100 ms of written data is left
    ahead of the media time while it waits on the demuxer. The margin
    covers platforms whose clock stops slightly early (e.g. Starboard's
    audio renderer on audio starvation).
  - Audio starvation, or video starvation without audio, starts an
    underflow right away. Video-only starvation while audio has data is
    tolerated for 3 s first, like RendererImpl's video underflow
    threshold (crbug.com/144683).
  - An underflow ends when every stream has 500 ms of written data
    ahead, has written end of stream, or has had no read pending for 1 s
    while having data ahead (the pipeline is full and can't hold 500 ms,
    so it would otherwise never resume).
- PlaybackUnderflowHandler (new) is an interface created with
  PlaybackUnderflowHandler::Create(enabled, ...). When enabled, the
  implementation polls the detector every 100 ms while presenting and
  acts through a Delegate: on underflow it pauses the SbPlayer (stopping
  the media clock) and reports BUFFERING_HAVE_NOTHING with
  DEMUXER_UNDERFLOW; on recovery it resumes the SbPlayer at the app's
  playback rate and reports BUFFERING_HAVE_ENOUGH. While paused for
  underflow, app rate changes are held and applied on resume, and a user
  pause keeps the SbPlayer paused. If the SbPlayer presents again during
  an underflow (e.g. after being recreated), the underflow is cleared and
  the app's rate restored. When disabled, a null implementation does
  nothing, so the renderer needs no feature checks.
- StarboardRenderer forwards lifecycle events (start, presenting, end
  of stream, flush, written buffers) to the handler and skips applying
  rate changes while IsPausedForUnderflow(). The Delegate is
  implemented by StarboardRenderer::UnderflowDelegate, a nested class
  defined in starboard_renderer.cc. A new
  OnBufferingStateChangeWithReason() passes the reason; existing callers
  of OnBufferingStateChange() are unchanged. URL players (tvOS) are not
  monitored, as their data doesn't go through the demuxer.
  GetMediaTime() keeps reporting the SbPlayer position while paused for
  underflow, rather than the seek time it reports for other
  BUFFERING_HAVE_NOTHING periods (youtube#13721).

Enable for testing with:
  --enable-h5vcc-settings=Media.HandlePlaybackUnderflow=1

Bug: 578446041
Change-Id: I939a789a6e39651dd87c871a6e473b2328ca3e18
kjyoun added a commit to kjyoun/cobalt that referenced this pull request Nov 4, 2026
SbPlayer has no rebuffering state. When one stream runs out of data
mid-playback while the other is still buffered (e.g. video starves
while audio is buffered), the media clock keeps advancing on the
remaining stream. StarboardRenderer reported BUFFERING_HAVE_ENOUGH on
kSbPlayerStatePresenting and BUFFERING_HAVE_NOTHING only on Flush(), so
such an underflow was never surfaced: readyState stayed
HAVE_ENOUGH_DATA, no 'waiting' event fired, currentTime kept advancing,
and web apps could not detect the stall. On YouTube this shows up as
frozen video with audio playing and no rebuffering spinner after
switching to a format the network can't sustain (b/578446041).

Behind the new Media.HandlePlaybackUnderflow experimental feature (an
h5vcc setting, off by default):
- PlaybackUnderflowDetector (new) is a pure state machine over the data
  written to the SbPlayer per stream:
  - A stream is starved when less than 100 ms of written data is left
    ahead of the media time while it waits on the demuxer. The margin
    covers platforms whose clock stops slightly early (e.g. Starboard's
    audio renderer on audio starvation).
  - Audio starvation, or video starvation without audio, starts an
    underflow right away. Video-only starvation while audio has data
    ahead (even after audio end of stream is written) is tolerated for
    3 s first, like RendererImpl's video underflow threshold
    (crbug.com/144683). The delay is only cancelled once video
    has caught up (100 ms ahead), or while playback isn't checked (e.g.
    paused by the app), so a trickle of video data can't postpone it.
  - An underflow ends when every stream has 500 ms of written data
    ahead, has written end of stream, or is saturated: no read pending
    and nothing written for 1 s, i.e. the SbPlayer stopped asking for
    data (the pipeline is full and can't hold 500 ms, so it would
    otherwise never resume).
- PlaybackUnderflowHandler (new) is an interface created with
  PlaybackUnderflowHandler::Create(enabled, ...). When enabled, the
  implementation polls the detector every 100 ms while presenting and
  acts through a Delegate: on underflow it pauses the SbPlayer (stopping
  the media clock) and reports BUFFERING_HAVE_NOTHING with
  DEMUXER_UNDERFLOW; on recovery it resumes the SbPlayer at the app's
  playback rate and reports BUFFERING_HAVE_ENOUGH. While paused for
  underflow, app rate changes are held and applied on resume, and a user
  pause keeps the SbPlayer paused. Defensively, if the SbPlayer presents
  again during an underflow (e.g. if it is ever re-prerolled without a
  Flush()) or reaches end of stream during an underflow, the underflow
  is cleared and the app's rate restored. When disabled, a null
  implementation does nothing, so the renderer needs no feature checks.
- StarboardRenderer forwards lifecycle events (start, presenting, end
  of stream, flush, written buffers) to the handler and skips applying
  rate changes while IsPausedForUnderflow(). The Delegate is
  implemented by StarboardRenderer::UnderflowDelegate, a nested class
  defined in starboard_renderer.cc. A new
  OnBufferingStateChangeWithReason() passes the reason; existing callers
  of OnBufferingStateChange() are unchanged. URL players (tvOS) are not
  monitored, as their data doesn't go through the demuxer.
  GetMediaTime() keeps reporting the SbPlayer position while paused for
  underflow, rather than the seek time it reports for other
  BUFFERING_HAVE_NOTHING periods (youtube#13721).

Enable for testing with:
  --enable-h5vcc-settings=Media.HandlePlaybackUnderflow=1

Bug: 578446041
Change-Id: I6cff893f1da915d936579351b1b772c1f54bb822
kjyoun added a commit to kjyoun/cobalt that referenced this pull request Nov 4, 2026
SbPlayer has no rebuffering state. When one stream runs out of data
mid-playback while the other is still buffered (e.g. video starves
while audio is buffered), the media clock keeps advancing on the
remaining stream. StarboardRenderer reported BUFFERING_HAVE_ENOUGH on
kSbPlayerStatePresenting and BUFFERING_HAVE_NOTHING only on Flush(), so
such an underflow was never surfaced: readyState stayed
HAVE_ENOUGH_DATA, no 'waiting' event fired, currentTime kept advancing,
and web apps could not detect the stall. On YouTube this shows up as
frozen video with audio playing and no rebuffering spinner after
switching to a format the network can't sustain (b/578446041).

Behind the new Media.HandlePlaybackUnderflow experimental feature (an
h5vcc setting, off by default):
- PlaybackUnderflowDetector (new) is a pure state machine over the data
  written to the SbPlayer per stream:
  - A stream is starved when less than 100 ms of written data is left
    ahead of the media time while it waits on the demuxer. The margin
    covers platforms whose clock stops slightly early (e.g. Starboard's
    audio renderer on audio starvation).
  - Audio starvation, or video starvation without audio, starts an
    underflow right away. Video-only starvation while audio has data
    ahead (even after audio end of stream is written) is tolerated for
    3 s first, like RendererImpl's video underflow threshold
    (crbug.com/144683). The delay is only cancelled once video
    has caught up (100 ms ahead), or while playback isn't checked (e.g.
    paused by the app), so a trickle of video data can't postpone it.
  - An underflow ends when every stream has 500 ms of written data
    ahead, has written end of stream, or is saturated: no read pending
    and nothing written for 1 s, i.e. the SbPlayer stopped asking for
    data (the pipeline is full and can't hold 500 ms, so it would
    otherwise never resume).
- PlaybackUnderflowHandler (new) is an interface created with
  PlaybackUnderflowHandler::Create(enabled, ...). When enabled, the
  implementation polls the detector every 100 ms while presenting and
  acts through a Delegate: on underflow it pauses the SbPlayer (stopping
  the media clock) and reports BUFFERING_HAVE_NOTHING with
  DEMUXER_UNDERFLOW; on recovery it resumes the SbPlayer at the app's
  playback rate and reports BUFFERING_HAVE_ENOUGH. While paused for
  underflow, app rate changes are held and applied on resume, and a user
  pause keeps the SbPlayer paused. Defensively, if the SbPlayer presents
  again during an underflow (e.g. if it is ever re-prerolled without a
  Flush()) or reaches end of stream during an underflow, the underflow
  is cleared and the app's rate restored. When disabled, a null
  implementation does nothing, so the renderer needs no feature checks.
- StarboardRenderer forwards lifecycle events (start, presenting, end
  of stream, flush, written buffers) to the handler and skips applying
  rate changes while IsPausedForUnderflow(). The Delegate is
  implemented by StarboardRenderer::UnderflowDelegate, a nested class
  defined in starboard_renderer.cc. A new
  OnBufferingStateChangeWithReason() passes the reason; existing callers
  of OnBufferingStateChange() are unchanged. URL players (tvOS) are not
  monitored, as their data doesn't go through the demuxer.
  GetMediaTime() keeps reporting the SbPlayer position while paused for
  underflow, rather than the seek time it reports for other
  BUFFERING_HAVE_NOTHING periods (youtube#13721).

Enable for testing with:
  --enable-h5vcc-settings=Media.HandlePlaybackUnderflow=1

Bug: 578446041
Change-Id: I6cff893f1da915d936579351b1b772c1f54bb822
cobalt-github-releaser-bot pushed a commit that referenced this pull request Nov 23, 2026
… until SbPlayer presents

Refer to original PR: #13721

After `StartPlayingFrom()` calls `SbPlayerSeek()`, `SbPlayerGetInfo()`
may keep returning the pre-seek position until the platform completes
the seek asynchronously. `PipelineImpl` only substitutes the seek time
until `OnSeekDone`, which is posted right after `StartPlayingFrom()`,
and afterwards clamps media time so that it never goes backwards. A
stale pre-seek value therefore latches into
`PipelineImpl::last_media_time_`, freezing `currentTime` after a
backwards seek for the length of the seek. The web app then shows
buffering and eventually reloads the player.

Cobalt 25's `SbPlayerPipeline::GetMediaTime()` returned the seek time
until the SbPlayer reached `kSbPlayerStatePresenting`. This restores
that behavior in `StarboardRenderer`: while `buffering_state_` is
`BUFFERING_HAVE_NOTHING` (from construction or `Flush()` until the
SbPlayer reaches `kSbPlayerStatePresenting`), `GetMediaTime()` reports
`seek_time_`.

Testing:
- Device with an asynchronous SbPlayerSeek() implementation (27.lts
build): seeking back 20s while playing froze `currentTime` for ~20s
before the change (logs show `SbPlayerGetInfo()` returning 41.39s right
after `StartPlayingFrom(21.38s)`), and resumes from the seek target
immediately after it. Forward seeks into unbuffered ranges and
back-to-back seeks also behave normally.
- RDK: not affected before or after, as its `SbPlayerSeek()` records the
seek target synchronously.
- Added
`StarboardRendererTest.GetMediaTimeReportsSeekTimeUntilPresenting` and
`StarboardRendererTest.GetMediaTimeReportsSeekTimeAfterBackwardSeek`,
which fail without this change (reporting the pre-seek time instead of
20s). `StarboardRendererTest.*` and `SbPlayerBridge*` pass on
linux-x64x11 devel.

Bug: 575365692
TAG=agy
CONV=95eeeebe-e64a-4dba-b215-21568808834d

(cherry picked from commit 0fa4078)
andrewsavage1 added a commit that referenced this pull request Nov 23, 2026
Fixes for rolled commits that build on main but break against
staging's newer Chromium base:

- third_party/icu/scripts/generate_cobalt_icudata.py (#12800): build
  the ICU host tools as ICU clients. Since ICU 77, the
  U_*_IMPLEMENTATION defines move header-only helpers such as
  icu::toUCharPtr() into icu::internal, so genrb failed to compile with
  staging's ICU 78:
    reslist.h:329:48: error: no member named 'toUCharPtr' in namespace 'icu_78'
- cobalt/android/cobalt_process_state_summary_jni.cc (#12616): add
  DEFINE_JNI(CobaltProcessStateSummary). Staging's jni_zero requires it
  for classes with natives. Without it, Android fails with
  -Wunused-function on the JNI_ functions, and AOSP fails to link with
  undefined Muxed_dev_cobalt_coat_CobaltProcessStateSummary_* symbols.
- media/starboard/sbplayer_bridge_test.cc (#13807),
  media/starboard/starboard_renderer_unittest.cc (#13721, #13807) and
  cobalt/app/app_event_delegate_unittest.cc: pass the lambdas directly
  to WillOnce()/WillRepeatedly() instead of wrapping them in the
  deprecated testing::Invoke() (-Werror,-Wdeprecated-declarations).
- third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc
  (#13593): use BindOnce instead of WTF::BindOnce, since staging's
  Blink no longer has the WTF namespace.

Bug: 574599290
TAG=agy
CONV=2c5cf2b4-5ccb-4755-8885-0e4970a60804
andrewsavage1 added a commit that referenced this pull request Nov 24, 2026
Fixes for rolled commits that build on main but break against
staging's newer Chromium base:

- third_party/icu/scripts/generate_cobalt_icudata.py (#12800): build
  the ICU host tools as ICU clients. Since ICU 77, the
  U_*_IMPLEMENTATION defines move header-only helpers such as
  icu::toUCharPtr() into icu::internal, so genrb failed to compile with
  staging's ICU 78:
    reslist.h:329:48: error: no member named 'toUCharPtr' in namespace 'icu_78'
- cobalt/android/cobalt_process_state_summary_jni.cc (#12616): add
  DEFINE_JNI(CobaltProcessStateSummary). Staging's jni_zero requires it
  for classes with natives. Without it, Android fails with
  -Wunused-function on the JNI_ functions, and AOSP fails to link with
  undefined Muxed_dev_cobalt_coat_CobaltProcessStateSummary_* symbols.
- media/starboard/sbplayer_bridge_test.cc (#13807),
  media/starboard/starboard_renderer_unittest.cc (#13721, #13807) and
  cobalt/app/app_event_delegate_unittest.cc: pass the lambdas directly
  to WillOnce()/WillRepeatedly() instead of wrapping them in the
  deprecated testing::Invoke() (-Werror,-Wdeprecated-declarations).
- third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc
  (#13593): use BindOnce instead of WTF::BindOnce, since staging's
  Blink no longer has the WTF namespace.
- cobalt/browser/h5vcc_system/h5vcc_system_impl_android.cc and
  cobalt/browser/h5vcc_system_browsertest.cc (#13593): use
  base::android::android_info::sdk_int()/SDK_VERSION_R. Staging's base
  no longer has base/android/build_info.h.

Bug: 574599290
TAG=agy
CONV=2c5cf2b4-5ccb-4755-8885-0e4970a60804
cobalt-roller-and-merger Bot pushed a commit that referenced this pull request Nov 24, 2026
… until SbPlayer presents

Refer to original PR: #13721

After `StartPlayingFrom()` calls `SbPlayerSeek()`, `SbPlayerGetInfo()`
may keep returning the pre-seek position until the platform completes
the seek asynchronously. `PipelineImpl` only substitutes the seek time
until `OnSeekDone`, which is posted right after `StartPlayingFrom()`,
and afterwards clamps media time so that it never goes backwards. A
stale pre-seek value therefore latches into
`PipelineImpl::last_media_time_`, freezing `currentTime` after a
backwards seek for the length of the seek. The web app then shows
buffering and eventually reloads the player.

Cobalt 25's `SbPlayerPipeline::GetMediaTime()` returned the seek time
until the SbPlayer reached `kSbPlayerStatePresenting`. This restores
that behavior in `StarboardRenderer`: while `buffering_state_` is
`BUFFERING_HAVE_NOTHING` (from construction or `Flush()` until the
SbPlayer reaches `kSbPlayerStatePresenting`), `GetMediaTime()` reports
`seek_time_`.

Testing:
- Device with an asynchronous SbPlayerSeek() implementation (27.lts
build): seeking back 20s while playing froze `currentTime` for ~20s
before the change (logs show `SbPlayerGetInfo()` returning 41.39s right
after `StartPlayingFrom(21.38s)`), and resumes from the seek target
immediately after it. Forward seeks into unbuffered ranges and
back-to-back seeks also behave normally.
- RDK: not affected before or after, as its `SbPlayerSeek()` records the
seek target synchronously.
- Added
`StarboardRendererTest.GetMediaTimeReportsSeekTimeUntilPresenting` and
`StarboardRendererTest.GetMediaTimeReportsSeekTimeAfterBackwardSeek`,
which fail without this change (reporting the pre-seek time instead of
20s). `StarboardRendererTest.*` and `SbPlayerBridge*` pass on
linux-x64x11 devel.

Bug: 575365692
TAG=agy
CONV=95eeeebe-e64a-4dba-b215-21568808834d

(cherry picked from commit 0fa4078)
cobalt-roller-and-merger Bot pushed a commit that referenced this pull request Nov 24, 2026
Fixes for rolled commits that build on main but break against
staging's newer Chromium base:

- third_party/icu/scripts/generate_cobalt_icudata.py (#12800): build
  the ICU host tools as ICU clients. Since ICU 77, the
  U_*_IMPLEMENTATION defines move header-only helpers such as
  icu::toUCharPtr() into icu::internal, so genrb failed to compile with
  staging's ICU 78:
    reslist.h:329:48: error: no member named 'toUCharPtr' in namespace 'icu_78'
- cobalt/android/cobalt_process_state_summary_jni.cc (#12616): add
  DEFINE_JNI(CobaltProcessStateSummary). Staging's jni_zero requires it
  for classes with natives. Without it, Android fails with
  -Wunused-function on the JNI_ functions, and AOSP fails to link with
  undefined Muxed_dev_cobalt_coat_CobaltProcessStateSummary_* symbols.
- media/starboard/sbplayer_bridge_test.cc (#13807),
  media/starboard/starboard_renderer_unittest.cc (#13721, #13807) and
  cobalt/app/app_event_delegate_unittest.cc: pass the lambdas directly
  to WillOnce()/WillRepeatedly() instead of wrapping them in the
  deprecated testing::Invoke() (-Werror,-Wdeprecated-declarations).
- third_party/blink/renderer/modules/cobalt/h5vcc_system/h_5_vcc_system.cc
  (#13593): use BindOnce instead of WTF::BindOnce, since staging's
  Blink no longer has the WTF namespace.
- cobalt/browser/h5vcc_system/h5vcc_system_impl_android.cc and
  cobalt/browser/h5vcc_system_browsertest.cc (#13593): use
  base::android::android_info::sdk_int()/SDK_VERSION_R. Staging's base
  no longer has base/android/build_info.h.

Bug: 574599290
TAG=agy
CONV=2c5cf2b4-5ccb-4755-8885-0e4970a60804
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cp-27.lts Cherry Pick to the 27.lts branch

4 participants