@ -34,6 +34,7 @@
# include "libavutil/channel_layout.h"
# include "libavutil/crc.h"
# include "libavutil/frame.h"
# include "libavutil/hwcontext.h"
# include "libavutil/internal.h"
# include "libavutil/mathematics.h"
# include "libavutil/mem_internal.h"
@ -1489,6 +1490,16 @@ FF_ENABLE_DEPRECATION_WARNINGS
avctx - > time_base . den ) ;
goto free_and_end ;
}
if ( avctx - > hw_frames_ctx ) {
AVHWFramesContext * frames_ctx = ( AVHWFramesContext * ) avctx - > hw_frames_ctx - > data ;
if ( frames_ctx - > format ! = avctx - > pix_fmt ) {
av_log ( avctx , AV_LOG_ERROR ,
" Mismatching AVCodecContext.pix_fmt and AVHWFramesContext.format \n " ) ;
ret = AVERROR ( EINVAL ) ;
goto free_and_end ;
}
}
}
avctx - > pts_correction_num_faulty_pts =
@ -2564,6 +2575,8 @@ av_cold int avcodec_close(AVCodecContext *avctx)
av_freep ( & avctx - > coded_side_data ) ;
avctx - > nb_coded_side_data = 0 ;
av_buffer_unref ( & avctx - > hw_frames_ctx ) ;
if ( avctx - > priv_data & & avctx - > codec & & avctx - > codec - > priv_class )
av_opt_free ( avctx - > priv_data ) ;
av_opt_free ( avctx ) ;