ladybird/Libraries/LibMedia/Sinks
Zaggy1024 7745d9209d LibMedia: Sync AudioMixingSink::set_time onto the stream thread
With the previous setup setting the time directly on the main thread,
the following could occur:

- HTMLMediaElement temporarily pauses playback to begin a seek.
- AudioMixingSink starts an audio task to drain audio and suspend.
- HTMLMediaElement starts PlaybackManager seeking to a new position.
- AudioDataProvider completes the seek to the new position.
- The PlaybackManager tells AudioMixingSink to set the media time,
  which it does so synchronously on the main thread.
- At this point, the time provider corresponds to the new position.
- The pause completes, and a deferred invocation sets media time to
  its old position again.

This would result in the timeline showing the wrong position after a
seek on rare occasions.

Instead, always queue up a drain and suspend when setting the sink's
media time. This ensures that updating the time always occurs after the
pause has completed.

Also, since setting the time is asynchronous now, we need to store the
target time until the seeking drain completes. Otherwise, we still
briefly see the previous playback position after a seek.
2025-10-27 17:28:49 -07:00
..
AudioMixingSink.cpp LibMedia: Sync AudioMixingSink::set_time onto the stream thread 2025-10-27 17:28:49 -07:00
AudioMixingSink.h LibMedia: Sync AudioMixingSink::set_time onto the stream thread 2025-10-27 17:28:49 -07:00
AudioSink.h
DisplayingVideoSink.cpp LibMedia: Implement media seeking 2025-10-27 17:28:49 -07:00
DisplayingVideoSink.h LibMedia: Implement media seeking 2025-10-27 17:28:49 -07:00
VideoSink.h