From 925715c734d5f9d594468c38dd19672e23e9e69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 8 Mar 2022 16:05:17 +0200 Subject: [PATCH] av{aud,vid}dec: Report decoding errors to the base class Part-of: --- subprojects/gst-libav/ext/libav/gstavauddec.c | 21 ++++++++++++------- subprojects/gst-libav/ext/libav/gstavviddec.c | 9 ++++---- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/subprojects/gst-libav/ext/libav/gstavauddec.c b/subprojects/gst-libav/ext/libav/gstavauddec.c index d12f9b29be..28a1851ab1 100644 --- a/subprojects/gst-libav/ext/libav/gstavauddec.c +++ b/subprojects/gst-libav/ext/libav/gstavauddec.c @@ -545,14 +545,15 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, if (ffmpegdec->frame->flags & AV_FRAME_FLAG_CORRUPT) GST_BUFFER_FLAG_SET (*outbuf, GST_BUFFER_FLAG_CORRUPTED); } else if (res == AVERROR (EAGAIN)) { + GST_DEBUG_OBJECT (ffmpegdec, "Need more data"); *outbuf = NULL; *need_more_data = TRUE; } else if (res == AVERROR_EOF) { *ret = GST_FLOW_EOS; GST_DEBUG_OBJECT (ffmpegdec, "Context was entirely flushed"); } else if (res < 0) { - *ret = GST_FLOW_OK; - GST_WARNING_OBJECT (ffmpegdec, "Legitimate decoding error"); + GST_AUDIO_DECODER_ERROR (ffmpegdec, 1, STREAM, DECODE, (NULL), + ("Audio decoding error"), *ret); } beach: @@ -834,12 +835,16 @@ not_negotiated: send_packet_failed: { - GST_WARNING_OBJECT (ffmpegdec, "decoding error"); - /* Even if ffmpeg was not able to decode current audio frame, - * we should call gst_audio_decoder_finish_frame() so that baseclass - * can clear its internal status and can respect timestamp of later - * incoming buffers */ - ret = gst_ffmpegauddec_drain (ffmpegdec, TRUE); + GST_AUDIO_DECODER_ERROR (ffmpegdec, 1, STREAM, DECODE, (NULL), + ("Audio decoding error"), ret); + + if (ret == GST_FLOW_OK) { + /* Even if ffmpeg was not able to decode current audio frame, + * we should call gst_audio_decoder_finish_frame() so that baseclass + * can clear its internal status and can respect timestamp of later + * incoming buffers */ + ret = gst_ffmpegauddec_drain (ffmpegdec, TRUE); + } goto unmap; } } diff --git a/subprojects/gst-libav/ext/libav/gstavviddec.c b/subprojects/gst-libav/ext/libav/gstavviddec.c index 031e06beb9..39724df799 100644 --- a/subprojects/gst-libav/ext/libav/gstavviddec.c +++ b/subprojects/gst-libav/ext/libav/gstavviddec.c @@ -1778,15 +1778,16 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, res = avcodec_receive_frame (ffmpegdec->context, ffmpegdec->picture); /* No frames available at this time */ - if (res == AVERROR (EAGAIN)) + if (res == AVERROR (EAGAIN)) { + GST_DEBUG_OBJECT (ffmpegdec, "Need more data"); goto beach; - else if (res == AVERROR_EOF) { + } else if (res == AVERROR_EOF) { *ret = GST_FLOW_EOS; GST_DEBUG_OBJECT (ffmpegdec, "Context was entirely flushed"); goto beach; } else if (res < 0) { - *ret = GST_FLOW_OK; - GST_WARNING_OBJECT (ffmpegdec, "Legitimate decoding error"); + GST_VIDEO_DECODER_ERROR (ffmpegdec, 1, STREAM, DECODE, (NULL), + ("Video decoding error"), *ret); goto beach; }