fix(mpv): stop loading the ytdl hook for media-server streams
Every URL the player opens is a media-server stream or a local file, so mpv's bundled ytdl_hook has nothing to resolve. It still ran an on_load hook per open and, whenever an open failed, spawned yt-dlp with the full stream URL in its argv — access token included, readable through /proc on Linux. It also added ~700ms to every failed open and buried the real "[stream] Failed to open" line under three ytdl_hook errors. mpv decides whether to load the builtin script inside mpv_initialize, so this has to be an option set beforehand rather than a property set from Dart. Verified against mpv 0.41: --ytdl=yes logs "Loading lua script @ytdl_hook.lua", --ytdl=no never loads it. Apple is deliberately excluded: the bundled libmpv is built without Lua, so the option does not exist there and setting it would only print an mpv error on every player init.
This commit is contained in:
@@ -346,6 +346,13 @@ bool MpvPlayer::Initialize() {
|
||||
mpv_set_option_string(mpv_, "input-vo-keyboard", "no");
|
||||
mpv_set_option_string(mpv_, "osc", "no");
|
||||
mpv_set_option_string(mpv_, "terminal", "no");
|
||||
// Every URL Plezy opens is a media-server stream or a local file, never a
|
||||
// site mpv's bundled ytdl_hook could resolve. Loading it costs an on_load
|
||||
// hook per open and, on a failed open, spawns yt-dlp with the full stream
|
||||
// URL — access token included — in its argv, where /proc exposes it. mpv
|
||||
// gates loading the builtin script on this option at mpv_initialize time,
|
||||
// so it has to be set here rather than from Dart.
|
||||
mpv_set_option_string(mpv_, "ytdl", "no");
|
||||
|
||||
// Default to warn-level logging
|
||||
mpv_request_log_messages(mpv_, "warn");
|
||||
|
||||
Reference in New Issue
Block a user