[FFmpeg-cvslog] avcodec/h261dec: Set pict_type during init
Andreas Rheinhardt
git at videolan.org
Sat Apr 12 11:11:29 EEST 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Apr 9 14:39:37 2025 +0200| [cf1c52c5c6cc82a27080fdaee53354f026401c7f] | committer: Andreas Rheinhardt
avcodec/h261dec: Set pict_type during init
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf1c52c5c6cc82a27080fdaee53354f026401c7f
---
libavcodec/h261dec.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 840414cafc..146f979a5e 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -88,6 +88,12 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
avctx->framerate = (AVRational) { 30000, 1001 };
+ /* The H.261 analog of intra/key frames is setting the freeze picture release flag,
+ * but this does not guarantee that the frame uses intra-only encoding,
+ * so we still need to allocate dummy frames. So set pict_type to P here
+ * for all frames and override it after having decoded the frame. */
+ s->pict_type = AV_PICTURE_TYPE_P;
+
s->private_ctx = &h->common;
// set defaults
ret = ff_mpv_decode_init(s, avctx);
@@ -501,11 +507,6 @@ static int h261_decode_picture_header(H261DecContext *h, int *is_key)
if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA;
- /* H.261 has no I-frames, but if we pass AV_PICTURE_TYPE_I for the first
- * frame, the codec crashes if it does not contain all I-blocks
- * (e.g. when a packet is lost). */
- s->pict_type = AV_PICTURE_TYPE_P;
-
h->gob_number = 0;
return 0;
}
More information about the ffmpeg-cvslog
mailing list