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.
This commit is contained in:
wm4 2017-05-24 14:40:25 +02:00
parent 2a04906063
commit 2426f95e0f
1 changed files with 5 additions and 0 deletions

View File

@ -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 ||