History

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.

wm4 committed 7 years ago

Commit 60647201 parent e49cec52 files · +15 −3Browse files

Showing the changes to TOOLS/lua/command-test.lua (1 of 2 files). Show all

Unified · Split

TOOLS/lua/command-test.lua+13−3
@@ -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"}})
87end)87end)
88 88
89mp.register_event("shutdown", function()89function 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))
97end
98
99mp.register_event("shutdown", function()
100 freeze_test(false)
101end)
102
103mp.register_event("idle", function()
104 freeze_test(true)
95end)105end)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t