You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavc: set frame parameters after decoding only if necessary
Direct rendering capable decoders call get_buffer() which will set the frame parameters. Prevents frames with wrong parameters when a decoder outputs delayed frames after a resolution or pixel format change.
This commit is contained in:
@@ -1282,11 +1282,14 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi
|
|||||||
else {
|
else {
|
||||||
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
|
ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
|
||||||
avpkt);
|
avpkt);
|
||||||
picture->pkt_dts = avpkt->dts;
|
picture->pkt_dts = avpkt->dts;
|
||||||
picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
/* get_buffer is supposed to set frame parameters */
|
||||||
picture->width = avctx->width;
|
if (!(avctx->codec->capabilities & CODEC_CAP_DR1)) {
|
||||||
picture->height = avctx->height;
|
picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
|
||||||
picture->format = avctx->pix_fmt;
|
picture->width = avctx->width;
|
||||||
|
picture->height = avctx->height;
|
||||||
|
picture->format = avctx->pix_fmt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emms_c(); //needed to avoid an emms_c() call before every return;
|
emms_c(); //needed to avoid an emms_c() call before every return;
|
||||||
|
Reference in New Issue
Block a user