From 565efeeadaf1de5f8f64aa31cbc56e31748fb0b2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 5 Dec 2015 23:53:55 +0100 Subject: vd_lavc: fix avctx NULL checks If reinit after a fallback from hardware fails, this field can be NULL. The check in control() was broken due to a typo (found by Coverity), and decode() lacked the check entirely. --- video/decode/vd_lavc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'video/decode') diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 923fec308b..92ea8bd0d8 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -624,6 +624,9 @@ static void decode(struct dec_video *vd, struct demux_packet *packet, struct vd_lavc_params *opts = ctx->opts->vd_lavc_params; AVPacket pkt; + if (!avctx) + return; + if (flags) { // hr-seek framedrop vs. normal framedrop avctx->skip_frame = flags == 2 ? AVDISCARD_NONREF : opts->framedrop; @@ -724,7 +727,7 @@ static int control(struct dec_video *vd, int cmd, void *arg) return CONTROL_TRUE; case VDCTRL_QUERY_UNSEEN_FRAMES: { AVCodecContext *avctx = ctx->avctx; - if (!ctx) + if (!avctx) break; if (ctx->hwdec && ctx->hwdec->type == HWDEC_RPI) break; // MMAL has arbitrary buffering, thus unknown -- cgit v1.2.3