Bug 223612

Summary: Looping WebGL video with no audio freezes at end when rendered at currentTime == 0
Product: WebKit Reporter: Amin Mesbah <webkitbugzilla>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: eric.carlson, jer.noble, kkinnunen, peng.liu6, webkit-bug-importer, webkitbugzilla
Priority: P2 Keywords: InRadar
Version: Safari 14   
Hardware: Mac (Intel)   
OS: macOS 11   
Bug Depends on:    
Bug Blocks: 223918    
Attachments:
Description Flags
Minimal bug example with instructions none

Description Amin Mesbah 2021-03-22 17:03:45 PDT
Created attachment 423964 [details]
Minimal bug example with instructions

When a WebGL texture is being updated with frames from a looping playing video
element through calls to `gl.texImage2d()`, a set of conditions will
intermittently cause it to freeze when it reaches its end.

The set of conditions is:

- The video has no audio track.
- The video is looping.
- `gl.texImage2d()` gets called when the video's `currentTime` is 0.

This happens far more often when the system is under heavy load (many other
Safari tabs and windows are open doing lots of work).

At the point the video freezes:

- The WebGL texture stops visibly updating.
- The video's `currentTime` stops changing.
- `timeupdate` events stop firing.
- `video.seeking` is false.
- `video.paused` is false.

I have reproduced the issue with a minimal html/js file and public domain video,
which I've attached in a zip archive.

Open it in Safari with the system under load and refresh repeatedly until the
video freezes on its last frame.

The example code has two booleans near the top. The bug will not manifest if
either is set to false.
Comment 1 Radar WebKit Bug Importer 2021-03-29 17:04:13 PDT
<rdar://problem/75980644>