diff mbox series

[FFmpeg-devel] avcodec/mjpegbdec: return the amount of bytes consumed when discarding frames

Message ID 20221226113352.180-1-jamrial@gmail.com
State Accepted
Commit 64007595dcb5bb3c5f7bfa74d0b0f2e378f6007e
Headers show
Series [FFmpeg-devel] avcodec/mjpegbdec: return the amount of bytes consumed when discarding frames | expand

Checks

Context Check Description
andriy/commit_msg_x86 warning Please wrap lines in the body of the commit message between 60 and 72 characters.
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Dec. 26, 2022, 11:33 a.m. UTC
EAGAIN is not correct in this scenario. FFCodec.cb.decode() callback decoders
always return the amount of bytes consumed from the input packet (if any), and
report if a frame was generated by setting got_frame.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/mjpegbdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Dec. 27, 2022, 1:43 p.m. UTC | #1
On 12/26/2022 8:33 AM, James Almer wrote:
> EAGAIN is not correct in this scenario. FFCodec.cb.decode() callback decoders
> always return the amount of bytes consumed from the input packet (if any), and
> report if a frame was generated by setting got_frame.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/mjpegbdec.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
> index a82a95d70a..6d422e7a29 100644
> --- a/libavcodec/mjpegbdec.c
> +++ b/libavcodec/mjpegbdec.c
> @@ -144,7 +144,7 @@ read_header:
>       av_frame_move_ref(rframe, s->picture_ptr);
>       s->got_picture = 0;
>       if (avctx->skip_frame == AVDISCARD_ALL)
> -        return AVERROR(EAGAIN);
> +        return buf_size;
>       *got_frame = 1;
>   
>       if (!s->lossless && avctx->debug & FF_DEBUG_QP) {

Applied.
diff mbox series

Patch

diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index a82a95d70a..6d422e7a29 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -144,7 +144,7 @@  read_header:
     av_frame_move_ref(rframe, s->picture_ptr);
     s->got_picture = 0;
     if (avctx->skip_frame == AVDISCARD_ALL)
-        return AVERROR(EAGAIN);
+        return buf_size;
     *got_frame = 1;
 
     if (!s->lossless && avctx->debug & FF_DEBUG_QP) {