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
1 changed files with 1 additions and 4 deletions

View File

@ -174,7 +174,6 @@ typedef struct lavc_ctx {
bool flushing;
struct lavc_state state;
const char *decoder;
bool hwdec_requested;
bool hwdec_failed;
bool hwdec_notified;
@ -468,8 +467,6 @@ static void select_and_set_hwdec(struct mp_filter *vd)
int num_hwdecs = 0;
add_all_hwdec_methods(&hwdecs, &num_hwdecs);
ctx->hwdec_requested = true;
for (int n = 0; n < num_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) {
MP_INFO(vd, "Using hardware decoding (%s).\n",
ctx->hwdec.method_name);