Bug 1839993 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

[`ProcessDrain()` ignores all errors](https://searchfox.org/mozilla-central/rev/d307d4d9f06dab6d16e963a4318e5e8ff4899141/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp#217-230) in its pipeline and blindly resolve the `DecodePromise`, which cause problems in WebCodecs when an decoding-error is expected.

For example, given two encoded video frame `f1` and `f2`. `f1` is a valid key frame while `f2` is a corrupt frame.
- When `Decode(f1)` is called, `f1` stocks in the pipeline and then resolve the `DecodePromise` with an empty data
- When `Decode(f2)` is called, decoded `f1` is push out of the pipeline, returned in a resolved `DecodePromise`
- When `Drain()` is called, the corrupt `f2` is unable to be decoded so it returns a [decode error](https://searchfox.org/mozilla-central/rev/d307d4d9f06dab6d16e963a4318e5e8ff4899141/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp#1058). However, the `ProcessDrain()` will ignore this error, and resolve the `DecodePromise` with an empty data

In WebCodecs, an `EncodingError` is expected to be dispatched to the error-callback in this case. `FFmpegDataDecoder::ProcessDrain()` should not ignore the decode error.
[`ProcessDrain()` ignores all errors](https://searchfox.org/mozilla-central/rev/d307d4d9f06dab6d16e963a4318e5e8ff4899141/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp#217-230) in its pipeline and blindly resolve the `DecodePromise`, which cause problems in WebCodecs when an decoding-error is expected.

For example, given two encoded video frame `f1` and `f2`. `f1` is a valid key frame while `f2` is a corrupt frame.
- When `Decode(f1)` is called, `f1` stocks in the pipeline and then resolve the `DecodePromise` with an empty data
- When `Decode(f2)` is called, decoded `f1` is push out of the pipeline, returned in a resolved `DecodePromise`
- When `Drain()` is called, the corrupt `f2` is unable to be decoded so it returns a [decode error](https://searchfox.org/mozilla-central/rev/d307d4d9f06dab6d16e963a4318e5e8ff4899141/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp#1058). However, the `ProcessDrain()` will ignore this error, and resolve the `DecodePromise` with an empty data

In WebCodecs, an `EncodingError` is expected to be dispatched to the error-callback in this case. `FFmpegDataDecoder::ProcessDrain()` should not ignore the decode error.


The current workaround is to always enable low-latency so the data can be decoded immediately instead of being stocked in the pipeline.

Back to Bug 1839993 Comment 0