RESOLVED FIXED 284448
[WebCodecs] Limit the number of decode operations we can enqueue
https://bugs.webkit.org/show_bug.cgi?id=284448
Summary [WebCodecs] Limit the number of decode operations we can enqueue
Jean-Yves Avenard [:jya]
Reported 2024-12-11 01:53:20 PST
Per spec [1] ; when decode is called, we are to: 1- increment the "decodeQueueSize" 2- enqueue a control message 3- Process the control message queue 4- If the codec is saturated we are to return early with "not processed" 5- If not, decrement decodeQueueSize and pass the data to the "codec implementation" In our implementation, we have no concept of the codec being "saturated". as such we always immediately queue the data to be decoded to the AudioDecoder's queue. As a consequence, or decodeQueueSize is never greater than 0. In the webcodec's registry sample, https://w3c.github.io/webcodecs/samples/audio-video-player/audio_video_player.html the code relies on the decodeQueueSize() increasing in size to know when to stop enqueue. With our implementation, as the queue size is always 0, we decode and very quickly fills the audio ring buffer and those decoded audio frames are lost. We should limit the number of audio decode we run simultaneously, Chrome appears to limit that number to just 1. We should do the same. [1] https://w3c.github.io/webcodecs/#dom-audiodecoder-decode
Attachments
Radar WebKit Bug Importer
Comment 1 2024-12-11 01:53:29 PST
Jean-Yves Avenard [:jya]
Comment 2 2024-12-11 18:16:33 PST
EWS
Comment 3 2024-12-13 10:07:04 PST
Committed 287798@main (53a8065088fb): <https://commits.webkit.org/287798@main> Reviewed commits have been landed. Closing PR #37811 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.