Przeglądaj źródła

avcodec/mpeg4videodec,h263dec: Only set skipped_last_frame for !vop_coded

This is more in line with the spec and avoids a branch.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Andreas Rheinhardt 6 miesięcy temu
rodzic
commit
2865ebd1fb
2 zmienionych plików z 3 dodań i 1 usunięć
  1. 0 1
      libavcodec/h263dec.c
  2. 3 0
      libavcodec/mpeg4videodec.c

+ 0 - 1
libavcodec/h263dec.c

@@ -463,7 +463,6 @@ int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict,
 #endif
     } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
         ret = ff_mpeg4_decode_picture_header(s);
-        s->skipped_last_frame = (ret == FRAME_SKIPPED);
     } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
         ret = ff_intel_h263_decode_picture_header(s);
     } else if (CONFIG_FLV_DECODER && s->h263_flv) {

+ 3 - 0
libavcodec/mpeg4videodec.c

@@ -3265,6 +3265,7 @@ static int decode_vop_header(Mpeg4DecContext *ctx, GetBitContext *gb,
     if (get_bits1(gb) != 1) {
         if (s->avctx->debug & FF_DEBUG_PICT_INFO)
             av_log(s->avctx, AV_LOG_ERROR, "vop not coded\n");
+        s->skipped_last_frame = 1;
         return FRAME_SKIPPED;
     }
     if (ctx->new_pred)
@@ -3691,6 +3692,8 @@ int ff_mpeg4_decode_picture_header(MpegEncContext *s)
 {
     Mpeg4DecContext *const ctx = (Mpeg4DecContext*)s;
 
+    s->skipped_last_frame = 0;
+
     if (ctx->bitstream_buffer) {
         int buf_size = get_bits_left(&s->gb) / 8U;
         int bitstream_buffer_size = ctx->bitstream_buffer->size;