summaryrefslogtreecommitdiff
path: root/libavcodec/hevc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2015-07-12 18:57:10 +0200
committerAnton Khirnov <anton@khirnov.net>2015-07-12 18:57:10 +0200
commit077b55943330150db0eafd36bbee614697cabd98 (patch)
treea8a7bc7b9636cb3836864af1b47335cba7d2da10 /libavcodec/hevc.c
parent18156b53f9b642b71c182c5c9818175a61572d2b (diff)
hevc: handle a NULL sps in set_sps() properly
This can happen in update_thread_context(), when the previous frame was corrupted.
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r--libavcodec/hevc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 6efdfcbaca..dd56d58839 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -435,13 +435,19 @@ static int set_sps(HEVCContext *s, const HEVCSPS *sps)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
int ret;
- export_stream_params(s->avctx, &s->ps, sps);
-
pic_arrays_free(s);
+ s->ps.sps = NULL;
+ s->ps.vps = NULL;
+
+ if (!sps)
+ return 0;
+
ret = pic_arrays_init(s, sps);
if (ret < 0)
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 CONFIG_HEVC_DXVA2_HWACCEL
*fmt++ = AV_PIX_FMT_DXVA2_VLD;