Bug 233861 - REGRESSION(r284711): [GStreamer] Buffering, seek broken on youtube.com
Summary: REGRESSION(r284711): [GStreamer] Buffering, seek broken on youtube.com
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Philippe Normand
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-05 08:42 PST by Michael Catanzaro
Modified: 2022-03-10 08:27 PST (History)
5 users (show)

See Also:


Attachments
Buffer health decreasing after entering fullscreen (31.87 MB, video/mp4)
2022-02-21 23:00 PST, Kdwk
no flags Details
Patch (12.09 KB, patch)
2022-03-10 04:35 PST, Philippe Normand
no flags Details | Formatted Diff | Diff
Patch for landing (12.10 KB, patch)
2022-03-10 05:49 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2021-12-05 08:42:55 PST
Since 2.35.1, we seem to be somehow really bad at buffering YouTube videos. WebKit has always been very unreliable at this -- it's been common for years to have to refresh the entire page when a video begins buffering -- but now it seems to have gotten much, much worse. I've been trying to watch a particular YouTube video that I've had to restart *dozens* of times now because it seems to just stop downloading additional data, and when this happens the only way to get it to continue is to refresh the entire page. Between this and bug #233859 we have a pretty big problem with YouTube.

I can try to upload a GStreamer debug log next week if requested. I wonder if network debug might be helpful too.
Comment 1 Michael Catanzaro 2022-02-11 08:16:29 PST
This error seems to occur quite frequently during the first two minutes of video playback. It rarely ever occurs otherwise. If the video begins to buffer within the first two minutes, it will never finish buffering and the only way to continue video playback is Ctrl+R.
Comment 2 Michael Catanzaro 2022-02-20 14:21:09 PST
I found a workaround to make YouTube usable: manually seek to just before the end of the buffered region, and WebKit will reliably buffer more content.
Comment 3 Kdwk 2022-02-21 23:00:23 PST
Created attachment 452828 [details]
Buffer health decreasing after entering fullscreen

I would like to say that I'm able to reproduce this with WebKitGTK 2.35.3 on Gnome Web 42.beta-really-33-gd3ed97c96+.

Video tested: https://youtu.be/FIWE0hjrDNE (VP9/ opus)

Buffering is fine when the video is not maximized (resolution 1280*720). YouTube maintains a buffer of around 90 seconds. However, when the video is maximized (resolution 1920*1080) the buffer is no longer maintained and buffer health drops rapidly until it becomes 0 seconds and the video stops.
Comment 4 Kdwk 2022-02-21 23:25:13 PST
I have also observed that this behaviour only occurs for certain videos, like the one linked above. For other videos, playback is normal.
Comment 5 Michael Catanzaro 2022-02-22 07:56:39 PST
(In reply to kdwkleung from comment #3)
> Created attachment 452828 [details]
> Buffer health decreasing after entering fullscreen

(Unrelated: note that I am unable to play this video due to bug #183259. It seems WebKit is unable to play any video attached to WebKit Bugzilla.)
Comment 6 Michael Catanzaro 2022-03-08 18:06:44 PST
I've bisected this to r283609: before this revision, seeking YouTube videos works fine, but starting with this revision seek never works. Also, normal buffering usually (but not always?) fails even in the absence of any seek.

Now, r283609 got reverted in r284087, then landed again in r284711, so r284711 is probably the commit we need to revert. However, I haven't yet tested r284710 vs. r284711 to be 100% sure. Will check this very soon.
Comment 7 Michael Catanzaro 2022-03-09 09:46:53 PST
Confirmed: r284710 is good, r284711 is not.
Comment 8 Philippe Normand 2022-03-10 04:35:32 PST
Created attachment 454335 [details]
Patch
Comment 9 Michael Catanzaro 2022-03-10 05:12:31 PST
Comment on attachment 454335 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454335&action=review

Thank you!

> Source/WebCore/platform/graphics/SourceBufferPrivate.h:156
> +    virtual MediaTime timeFudgeFactor() const { return {2002, 24000}; }

Style bot is complaining about this, should have extra space: { 2002, 24000 }
Comment 10 Michael Catanzaro 2022-03-10 05:49:44 PST
Created attachment 454347 [details]
Patch for landing
Comment 11 EWS 2022-03-10 08:26:27 PST
Committed r291111 (248273@main): <https://commits.webkit.org/248273@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454347 [details].
Comment 12 Radar WebKit Bug Importer 2022-03-10 08:27:28 PST
<rdar://problem/90099475>