1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/h261dec: Set pict_type during init

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-04-09 14:39:37 +02:00
parent 88d8150de7
commit cf1c52c5c6

View File

@ -88,6 +88,12 @@ static av_cold int h261_decode_init(AVCodecContext *avctx)
avctx->framerate = (AVRational) { 30000, 1001 }; 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; s->private_ctx = &h->common;
// set defaults // set defaults
ret = ff_mpv_decode_init(s, avctx); 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) if (skip_1stop_8data_bits(&s->gb) < 0)
return AVERROR_INVALIDDATA; 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; h->gob_number = 0;
return 0; return 0;
} }