You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/media-video/mpv/files/0.17.0/mpv-0.17.0-fix-hwdec-fallba...

64 lines
1.8 KiB

commit b1a8e8dba66fb9c85e3a1d4e812d4f842db68fe6
Author: wm4 <wm4@nowhere>
Date: Fri Apr 22 15:45:23 2016 +0200
vd_lavc: fix hwdec fallback if hwdec pre-initialization fails
Damn.
---
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index a444f88..0bbe84c 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);