w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.
https://w3c.github.io/webcodecs/
Other
941 stars 132 forks source link

Missing description in decoderConfig when using AudioEncoder on Windows #663

Closed Vanilagy closed 1 year ago

Vanilagy commented 1 year ago

POSTING THIS HERE, because the Chromium bug tracker is currently giving me a 500 when I try to submit anything.

I've noticed strange and inconsistent behavior of AudioEncoder. Typically, when the encoder spits out encoded chunks, the metadata passed along with it contains a "decoderConfig" object containing a "description" property (Uint8Array). However, I have (painfully) noticed that this rarely happens on Windows when using AAC-LC.

I made a Glitch which reproduces the bug: https://apple-branched-organ.glitch.me/

The code should contain all relevant setup.

On my MacBook, this runs fine, giving me the description property the first time the metadata object is received. However, on Windows (I asked like, 5 of my friends), this does not happen. This caused unexpected behavior in my library, which expects this data to exist, and I temporarily patched it up by writing my own logic for synthesizing these description bytes: https://github.com/Vanilagy/mp4-muxer/blob/a5e6af0c57b3301dcd9fbf8d237811d309376e7b/src/muxer.ts#L179

When I worked with Opus AudioEncoders, I did not observe this behavior.

It worked for only one of my friends with a Windows 10 machine. Here's the Chrome version of somebody for whom it didn't work: 111.0.5563.149 (Official Build) (64-bit)

Now, my question is: Is this a bug, or is this simply allowed to happen and it is the developer's job to ensure they get proper decoder config bytes? Either way, inconsistencies between operating systems are never nice. It has to be added that the actual encoding of the audio works fine, even on Windows.

Djuffin commented 1 year ago

I opened a bug against Chromium: https://crbug.com/1433356