diff mbox series

[FFmpeg-devel,v3] avcodec/h264: ignore POC when flag is set

Message ID CAGB5vbHhn43vqK4SgcQK1jf+OjuheY0WBDJ8ZD8Xik4rqx9m2w@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel,v3] avcodec/h264: ignore POC when flag is set | expand

Checks

Context Check Description
andriy/configure_x86 warning Failed to apply patch
yinshiyou/configure_loongarch64 warning Failed to apply patch

Commit Message

Kevin Wang Sept. 16, 2024, 4:26 a.m. UTC
When the flag AV_CODEC_FLAG_OUTPUT_CORRUPT or AV_CODEC_FLAG2_SHOW_ALL
is set, ignore any out of order POC's as they may still be valid
frames.
---
Reformat with more lines so the patch is better.

 libavcodec/h264_slice.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

     out_of_order = out->poc < h->next_outputed_poc;

Comments

Anton Khirnov Sept. 17, 2024, 12:15 p.m. UTC | #1
Quoting Kevin Wang (2024-09-16 06:26:34)
> When the flag AV_CODEC_FLAG_OUTPUT_CORRUPT or AV_CODEC_FLAG2_SHOW_ALL
> is set, ignore any out of order POC's as they may still be valid
> frames.
> ---
> Reformat with more lines so the patch is better.
> 
>  libavcodec/h264_slice.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Do you have a test case for this?

Also, the patch formatting is still broken. If all else fails, you could
just send it as an attachment.
Kevin Wang Sept. 17, 2024, 1 p.m. UTC | #2
I have a file that repro's the issue along with a description of
what's going on in the file: https://trac.ffmpeg.org/ticket/11190

I can try dumping that into the `fate` samples? I don't see any
corrupted file samples in there though so I'm happy to follow whatever
guidance you can provide.

On Tue, Sep 17, 2024 at 8:15 AM Anton Khirnov <anton@khirnov.net> wrote:
>
> Quoting Kevin Wang (2024-09-16 06:26:34)
> > When the flag AV_CODEC_FLAG_OUTPUT_CORRUPT or AV_CODEC_FLAG2_SHOW_ALL
> > is set, ignore any out of order POC's as they may still be valid
> > frames.
> > ---
> > Reformat with more lines so the patch is better.
> >
> >  libavcodec/h264_slice.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
>
> Do you have a test case for this?
>
> Also, the patch formatting is still broken. If all else fails, you could
> just send it as an attachment.
>
> --
> Anton Khirnov
diff mbox series

Patch

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a66b75ca80..ddecd152a7 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1341,7 +1341,10 @@  static int h264_select_output_frame(H264Context *h)
             out_idx = i;
         }
     if (h->avctx->has_b_frames == 0 &&
-        ((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) ||
h->delayed_pic[0]->mmco_reset))
+        // Check if we should ignore the output order and output the frame
+        ((h->delayed_pic[0]->f->flags & AV_FRAME_FLAG_KEY) ||
+            h->delayed_pic[0]->mmco_reset ||
+            (h->avctx->flags & (AV_CODEC_FLAG_OUTPUT_CORRUPT |
AV_CODEC_FLAG2_SHOW_ALL))))
         h->next_outputed_poc = INT_MIN;