1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

hevc: handle a NULL sps in set_sps() properly

This can happen in update_thread_context(), when the previous frame was
corrupted.
This commit is contained in:
Anton Khirnov 2015-07-12 18:57:10 +02:00
parent 18156b53f9
commit 077b559433

View File

@ -435,13 +435,19 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts; enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
int ret; int ret;
export_stream_params(s->avctx, &s->ps, sps);
pic_arrays_free(s); pic_arrays_free(s);
s->ps.sps = NULL;
s->ps.vps = NULL;
if (!sps)
return 0;
ret = pic_arrays_init(s, sps); ret = pic_arrays_init(s, sps);
if (ret < 0) if (ret < 0)
goto fail; goto fail;
export_stream_params(s->avctx, &s->ps, sps);
if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P) { if (sps->pix_fmt == AV_PIX_FMT_YUV420P || sps->pix_fmt == AV_PIX_FMT_YUVJ420P) {
#if CONFIG_HEVC_DXVA2_HWACCEL #if CONFIG_HEVC_DXVA2_HWACCEL
*fmt++ = AV_PIX_FMT_DXVA2_VLD; *fmt++ = AV_PIX_FMT_DXVA2_VLD;