[FFmpeg-devel] [PATCH] lavc/vvc: Fix pix_fmt change detection

Nuo Mi nuomi2021 at gmail.com
Sun Jan 12 05:45:59 EET 2025


On Sat, Jan 11, 2025 at 9:18 PM Frank Plowman <post at frankplowman.com> wrote:

> In some scenarios, the VVCContext.pix_fmt and the
> AVCodecContext.pix_fmt can get out-of-sync.  It is more robust here
> to check the AVCodecContext.pix_fmt, as we already do for the width and
> height, seeing as the AVCodecContext.pix_fmt is the value which
> actually ends up being used to determine the number of channels in the
> allocated frame.
>
> Fixes null dereferences if the chroma format changes mid-sequence.
>
> Signed-off-by: Frank Plowman <post at frankplowman.com>
> ---
>  libavcodec/vvc/dec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/vvc/dec.c b/libavcodec/vvc/dec.c
> index 1cb168de7e..12a33ac798 100644
> --- a/libavcodec/vvc/dec.c
> +++ b/libavcodec/vvc/dec.c
> @@ -802,7 +802,7 @@ static int export_frame_params(VVCContext *s, const
> VVCFrameContext *fc)
>      int ret;
>
>      // Reset HW config if pix_fmt/w/h change.
> -    if (s->pix_fmt != sps->pix_fmt || c->coded_width != pps->width ||
> c->coded_height != pps->height) {
> +    if (c->pix_fmt != sps->pix_fmt || c->coded_width != pps->width ||
> c->coded_height != pps->height) {


It's related to hardware codec. @Wang, Fei W, please help review the patch.
Do we still need s->format if this patch is applied?

         c->coded_width  = pps->width;
>          c->coded_height = pps->height;
>          ret = get_format(c, sps);
> --
> 2.47.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-devel mailing list