summaryrefslogtreecommitdiffstats
path: root/video/decode
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-05-24 14:40:25 +0200
committerwm4 <wm4@nowhere>2017-05-24 14:40:25 +0200
commit2426f95e0fc232b01228457e5116b592c56b1f7f (patch)
treebd5820535bd82066aaa75359afd0f8e6ebaa508c /video/decode
parent2a049060636920b487c9cc58efe60b931e464b11 (diff)
downloadmpv-2426f95e0fc232b01228457e5116b592c56b1f7f.tar.bz2
mpv-2426f95e0fc232b01228457e5116b592c56b1f7f.tar.xz
vd_lavc: check for missing device_ctx ref
It's not really guaranteed that other components always set this (e.g. on subtle errors), so check it explicitly. Although I'm not aware of a failing case.
Diffstat (limited to 'video/decode')
-rw-r--r--video/decode/vd_lavc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 8febf93325..2e7d84e55b 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -750,6 +750,11 @@ int hwdec_setup_hw_frames_ctx(struct lavc_ctx *ctx, AVBufferRef *device_ctx,
int h = ctx->avctx->coded_height;
int av_hw_format = imgfmt2pixfmt(ctx->hwdec_fmt);
+ if (!device_ctx) {
+ MP_ERR(ctx, "Missing device context.\n");
+ return -1;
+ }
+
if (ctx->cached_hw_frames_ctx) {
AVHWFramesContext *fctx = (void *)ctx->cached_hw_frames_ctx->data;
if (fctx->width != w || fctx->height != h ||