mpv
mpv copied to clipboard
`play_current_file` called twice for the first file when using --autocreate-playlist
mpv Information
mpv v0.38.0-701-gacc69e082fff Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
built on Aug 15 2024 12:27:17
libplacebo version: v7.349.0
FFmpeg version: git-2024-08-13-66592e8b100f
FFmpeg library versions:
libavcodec 61.11.100
libavdevice 61.2.100
libavfilter 10.2.102
libavformat 61.5.101
libavutil 59.34.100
libswresample 5.2.100
libswscale 8.2.100
Important Information
- Platform version: Tumbleweed
- GPU model, driver and version: 6600 XT
- Source: git
- Introduced in version: bb9b862f0c7fdc98a5a82a116770d09ba1d4d152
Reproduction Steps
mpv --no-config --autocreate-playlist=same --script=foo.lua <some file>
foo.lua: mp.add_hook("on_load", 50, function (event) require"mp.msg".fatal("on_load hook called") end)
Here, the on_load hook will be called twice on the same file. Along with every other hooks and events that exist inside this highlighted region, as well as other hooks and events after goto terminate_playback.
auto profiles are also processed twice because of this, since the script listens for these hooks.
This only happens on the first file on our "fake" playlist, because the playlist must be populated first before the actual file can be played and the function doesn't know in advance whether it is a playlist or a real file.
Expected Behavior
Only receive on_load once
Actual Behavior
on_load hook is processed twice.
Log File
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
- [X] I tested with the latest mpv version to validate that the issue is not already fixed.
- [X] I provided all required information including system and mpv version.
- [X] I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of
--log-file=output.txt. - [X] I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
- [X] I attached the full, untruncated log file.
- [X] I attached the backtrace in the case of a crash.