mirror of https://github.com/mpv-player/mpv
player: "subprocess" command should stop immediately in idle mode
The description of the "playback_only" field in the "subprocess" command says "you can't start it outside of playback". This did not work correctly: if the player was started in idle mode in the first place, the subprocess was allowed to run even with playback_only=yes. This is a bug, and this change fixes it. Add a test for this to command-test.lua. For #7025.
This commit is contained in:
parent
e49cec5832
commit
6064720011
|
@ -86,10 +86,20 @@ mp.observe_property("vo-configured", "bool", function(_, v)
|
||||||
playback_only = false, args = {"sleep", "inf"}})
|
playback_only = false, args = {"sleep", "inf"}})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
mp.register_event("shutdown", function()
|
function freeze_test(playback_only)
|
||||||
-- This "freezes" the script, should be killed via timeout.
|
-- This "freezes" the script, should be killed via timeout.
|
||||||
print("freeze!")
|
counter = counter and counter + 1 or 0
|
||||||
local x = mp.command_native({name = "subprocess", playback_only = false,
|
print("freeze! " .. counter)
|
||||||
|
local x = mp.command_native({name = "subprocess",
|
||||||
|
playback_only = playback_only,
|
||||||
args = {"sleep", "inf"}})
|
args = {"sleep", "inf"}})
|
||||||
print("done, killed=" .. utils.to_string(x.killed_by_us))
|
print("done, killed=" .. utils.to_string(x.killed_by_us))
|
||||||
|
end
|
||||||
|
|
||||||
|
mp.register_event("shutdown", function()
|
||||||
|
freeze_test(false)
|
||||||
|
end)
|
||||||
|
|
||||||
|
mp.register_event("idle", function()
|
||||||
|
freeze_test(true)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -319,6 +319,8 @@ struct MPContext *mp_create(void)
|
||||||
if (verbose_env)
|
if (verbose_env)
|
||||||
mpctx->opts->verbose = atoi(verbose_env);
|
mpctx->opts->verbose = atoi(verbose_env);
|
||||||
|
|
||||||
|
mp_cancel_trigger(mpctx->playback_abort);
|
||||||
|
|
||||||
return mpctx;
|
return mpctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue