[FFmpeg-cvslog] avcodec/h264: Set CORRUPT flag on output frames that are not fully recovered

Sebastian Dröge git at videolan.org
Tue Dec 8 18:10:08 CET 2015


ffmpeg | branch: master | Sebastian Dröge <sebastian at centricular.com> | Tue Dec  8 10:24:09 2015 +0200| [9aebea0a4de1dc19c6309694cb1a5cd7554438cc] | committer: Michael Niedermayer

avcodec/h264: Set CORRUPT flag on output frames that are not fully recovered

In the merge commit 78265fcfeee153e5e26ad4dbc7831a84ade447d6 this behaviour
was broken and the CORRUPT flag would never ever be set on a frame. However
the flag on the AVCodecContext was taken into account properly, including
AV_CODEC_FLAG2_SHOW_ALL.

The reason for this was that the recovered field of the next output picture
was always set to TRUE whenever one of the two AVCodecContext flags was set,
which made it impossible to detect later, before outputting, if the frame was
really recovered or not. Now don't set it to TRUE unless the frame is really
recovered and check the AVCodecContext flags right before outputting.

Signed-off-by: Sebastian Dröge <sebastian at centricular.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9aebea0a4de1dc19c6309694cb1a5cd7554438cc
---

 libavcodec/h264.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6453c44..3d11328 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1556,8 +1556,6 @@ again:
                 // "recovered".
                 if (h->nal_unit_type == NAL_IDR_SLICE)
                     h->frame_recovered |= FRAME_RECOVERED_IDR;
-                h->frame_recovered |= 3*!!(avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL);
-                h->frame_recovered |= 3*!!(avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT);
 #if 1
                 h->cur_pic_ptr->recovered |= h->frame_recovered;
 #else
@@ -1863,7 +1861,8 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data,
 
         /* Wait for second field. */
         *got_frame = 0;
-        if (h->next_output_pic && (
+        if (h->next_output_pic && ((avctx->flags & AV_CODEC_FLAG_OUTPUT_CORRUPT) ||
+                                   (avctx->flags2 & AV_CODEC_FLAG2_SHOW_ALL) ||
                                    h->next_output_pic->recovered)) {
             if (!h->next_output_pic->recovered)
                 h->next_output_pic->f->flags |= AV_FRAME_FLAG_CORRUPT;



More information about the ffmpeg-cvslog mailing list