summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp')
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
index 30422987cf..e86ff63dba 100644
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -231,11 +231,22 @@ FFmpegDataDecoder<LIBAV_VER>::ProcessDrain() {
empty->mTimecode = mLastInputDts;
bool gotFrame = false;
DecodedData results;
- // When draining the FFmpeg decoder will return either a single frame at a
- // time until gotFrame is set to false; or return a block of frames with
- // NS_ERROR_DOM_MEDIA_END_OF_STREAM
- while (NS_SUCCEEDED(DoDecode(empty, &gotFrame, results)) && gotFrame) {
- }
+ // When draining the underlying FFmpeg decoder without encountering any
+ // problems, DoDecode will either return a single frame at a time until
+ // gotFrame is set to false, or it will return a block of frames with
+ // NS_ERROR_DOM_MEDIA_END_OF_STREAM (EOS). However, if any issue arises, such
+ // as pending data in the pipeline being corrupt or invalid, non-EOS errors
+ // like NS_ERROR_DOM_MEDIA_DECODE_ERR will be returned and must be handled
+ // accordingly.
+ do {
+ MediaResult r = DoDecode(empty, &gotFrame, results);
+ if (NS_FAILED(r)) {
+ if (r.Code() == NS_ERROR_DOM_MEDIA_END_OF_STREAM) {
+ break;
+ }
+ return DecodePromise::CreateAndReject(r, __func__);
+ }
+ } while (gotFrame);
return DecodePromise::CreateAndResolve(std::move(results), __func__);
}