1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 16:33:02 +00:00

vd_lavc: make hwdec fallback message more consistent

The "rule" is that a fallback warning message should be shown only shown
if software decoding was used before, or in other words when either
hwdec was enabled before, but the stream suddenly falls back, or it was
attempted to enable it at runtime, and it didn't work.

The message wasn't printed the first time in the latter case, because
hwdec_notified was not set in forced software decoding mode. Fix it with
this commit. Fortunately, the logic becomes simpler.
This commit is contained in:
wm4 2020-03-24 23:40:01 +01:00
parent 7768452f2d
commit e31fbbeeee

View File

@ -174,7 +174,6 @@ typedef struct lavc_ctx {
bool flushing; bool flushing;
struct lavc_state state; struct lavc_state state;
const char *decoder; const char *decoder;
bool hwdec_requested;
bool hwdec_failed; bool hwdec_failed;
bool hwdec_notified; bool hwdec_notified;
@ -468,8 +467,6 @@ static void select_and_set_hwdec(struct mp_filter *vd)
int num_hwdecs = 0; int num_hwdecs = 0;
add_all_hwdec_methods(&hwdecs, &num_hwdecs); add_all_hwdec_methods(&hwdecs, &num_hwdecs);
ctx->hwdec_requested = true;
for (int n = 0; n < num_hwdecs; n++) { for (int n = 0; n < num_hwdecs; n++) {
struct hwdec_info *hwdec = &hwdecs[n]; struct hwdec_info *hwdec = &hwdecs[n];
@ -1158,7 +1155,7 @@ static int receive_frame(struct mp_filter *vd, struct mp_frame *out_frame)
} }
} }
if (!ctx->hwdec_notified && ctx->hwdec_requested) { if (!ctx->hwdec_notified) {
if (ctx->use_hwdec) { if (ctx->use_hwdec) {
MP_INFO(vd, "Using hardware decoding (%s).\n", MP_INFO(vd, "Using hardware decoding (%s).\n",
ctx->hwdec.method_name); ctx->hwdec.method_name);