summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-04 16:30:48 +0200
committerwm4 <wm4@nowhere>2019-10-04 16:30:48 +0200
commit6064720011c7864bb97b4bb6dd2872246908c1c5 (patch)
tree68ef72845cbeebc821314e7f89d42b3cc716eb60 /TOOLS
parente49cec58328e549ba2da9d47e1845924281aabaa (diff)
downloadmpv-6064720011c7864bb97b4bb6dd2872246908c1c5.tar.bz2
mpv-6064720011c7864bb97b4bb6dd2872246908c1c5.tar.xz
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.
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/lua/command-test.lua16
1 files changed, 13 insertions, 3 deletions
diff --git a/TOOLS/lua/command-test.lua b/TOOLS/lua/command-test.lua
index dd384818cc..30d8cc05ff 100644
--- a/TOOLS/lua/command-test.lua
+++ b/TOOLS/lua/command-test.lua
@@ -86,10 +86,20 @@ mp.observe_property("vo-configured", "bool", function(_, v)
playback_only = false, args = {"sleep", "inf"}})
end)
-mp.register_event("shutdown", function()
+function freeze_test(playback_only)
-- This "freezes" the script, should be killed via timeout.
- print("freeze!")
- local x = mp.command_native({name = "subprocess", playback_only = false,
+ counter = counter and counter + 1 or 0
+ print("freeze! " .. counter)
+ local x = mp.command_native({name = "subprocess",
+ playback_only = playback_only,
args = {"sleep", "inf"}})
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)