summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-05 23:53:55 +0100
committerwm4 <wm4@nowhere>2015-12-05 23:53:55 +0100
commit565efeeadaf1de5f8f64aa31cbc56e31748fb0b2 (patch)
treef8001c85a990b4aa83d9d7f4ae9deae522663401 /video/decode/vd_lavc.c
parentc46106d63359ff663d71910e64398035146a8f46 (diff)
downloadmpv-565efeeadaf1de5f8f64aa31cbc56e31748fb0b2.tar.bz2
mpv-565efeeadaf1de5f8f64aa31cbc56e31748fb0b2.tar.xz
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.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c5
1 files changed, 4 insertions, 1 deletions
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