Bug 224237 - [GStreamer] At EOS, change position to match duration, not the other way around.
Summary: [GStreamer] At EOS, change position to match duration, not the other way around.
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alicia Boya García
Depends on:
Reported: 2021-04-06 08:12 PDT by Alicia Boya García
Modified: 2021-04-06 10:10 PDT (History)
13 users (show)

See Also:

Patch (3.98 KB, patch)
2021-04-06 08:17 PDT, Alicia Boya García
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alicia Boya García 2021-04-06 08:12:26 PDT
The criteria used to check if playback has finished is currentTime >=
duration. Currently MediaPlayerPrivateGStreamer::didEnd() ensures this
in an awkward way: by changing the duration so that it matches
currentTime, rather than the other way around.

This meant a duration change at the end of playback most of the time,
with a slightly different duration each time, since currentTime is
cached periodically.

This patch reworks that function to work more naturally and less racy:

First, only if the stream doesn't have a set duration (e.g. live
stream), we set a duration to currentTime, as defined in the spec.

Second, at EOS we update currentTime to match duration, rather than
the other way around.

This patch doesn't introduce changes in test results.
Comment 1 Alicia Boya García 2021-04-06 08:17:19 PDT
Created attachment 425280 [details]
Comment 2 EWS 2021-04-06 10:10:32 PDT
Committed r275528: <https://commits.webkit.org/r275528>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 425280 [details].