summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-22 15:45:23 +0200
committerwm4 <wm4@nowhere>2016-04-22 15:52:16 +0200
commitb1a8e8dba66fb9c85e3a1d4e812d4f842db68fe6 (patch)
tree34fc67bc00e2c883d0fbacb217dd2160df9dc41a
parent244eff92018487b08929a8a765706fa9fe8072de (diff)
downloadmpv-b1a8e8dba66fb9c85e3a1d4e812d4f842db68fe6.tar.bz2
mpv-b1a8e8dba66fb9c85e3a1d4e812d4f842db68fe6.tar.xz
vd_lavc: fix hwdec fallback if hwdec pre-initialization fails
Damn.
-rw-r--r--video/decode/vd_lavc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index a444f88c10..0bbe84c31b 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -284,17 +284,14 @@ static void uninit(struct dec_video *vd)
talloc_free(vd->priv);
}
-static bool force_fallback(struct dec_video *vd)
+static void force_fallback(struct dec_video *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
- if (!ctx->hwdec)
- return false;
uninit_avctx(vd);
int lev = ctx->hwdec_notified ? MSGL_WARN : MSGL_V;
mp_msg(vd->log, lev, "Falling back to software decoding.\n");
init_avctx(vd, ctx->decoder, NULL);
- return true;
}
static void reinit(struct dec_video *vd)
@@ -332,7 +329,7 @@ static void reinit(struct dec_video *vd)
}
init_avctx(vd, decoder, hwdec);
- if (!ctx->avctx)
+ if (!ctx->avctx && hwdec)
force_fallback(vd);
}
@@ -767,7 +764,8 @@ static struct mp_image *decode_with_fallback(struct dec_video *vd,
decode(vd, packet, flags, &mpi);
if (ctx->hwdec_failed) {
// Failed hardware decoding? Try again in software.
- if (force_fallback(vd) && ctx->avctx)
+ force_fallback(vd);
+ if (ctx->avctx)
decode(vd, packet, flags, &mpi);
}
@@ -805,8 +803,10 @@ static int control(struct dec_video *vd, int cmd, void *arg)
return CONTROL_TRUE;
}
case VDCTRL_FORCE_HWDEC_FALLBACK:
- if (force_fallback(vd))
+ if (ctx->hwdec) {
+ force_fallback(vd);
return ctx->avctx ? CONTROL_OK : CONTROL_ERROR;
+ }
return CONTROL_FALSE;
case VDCTRL_REINIT:
reinit(vd);