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.
Showing the changes to TOOLS/lua/command-test.lua (1 of 2 files). Show all
Unified · Split
| @@ -86,10 +86,20 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 85 unmodified lines | |||
| 86 | playback_only = false, args = {"sleep", "inf"}}) | 86 | playback_only = false, args = {"sleep", "inf"}}) |
| 87 | end) | 87 | end) |
| 88 | 88 | ||
| 89 | mp.register_event("shutdown", function() | 89 | function freeze_test(playback_only) |
| 90 | -- This "freezes" the script, should be killed via timeout. | 90 | -- This "freezes" the script, should be killed via timeout. |
| 91 | print("freeze!") | 91 | counter = counter and counter + 1 or 0 |
| 92 | local x = mp.command_native({name = "subprocess", playback_only = false, | 92 | print("freeze! " .. counter) |
| 93 | local x = mp.command_native({name = "subprocess", | ||
| 94 | playback_only = playback_only, | ||
| 93 | args = {"sleep", "inf"}}) | 95 | args = {"sleep", "inf"}}) |
| 94 | print("done, killed=" .. utils.to_string(x.killed_by_us)) | 96 | print("done, killed=" .. utils.to_string(x.killed_by_us)) |
| 97 | end | ||
| 98 | |||
| 99 | mp.register_event("shutdown", function() | ||
| 100 | freeze_test(false) | ||
| 101 | end) | ||
| 102 | |||
| 103 | mp.register_event("idle", function() | ||
| 104 | freeze_test(true) | ||
| 95 | end) | 105 | end) |