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.
This commit is contained in:
wm4 2015-12-05 23:53:55 +01:00
parent c46106d633
commit 565efeeada
1 changed files with 4 additions and 1 deletions

View File

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