Closed mochaaP closed 8 months ago
An easy fix is to deploy this to MPVCore::init()
, but I'm uncertain about the affect on thread safety, since setlocale
is MT-Unsafe const:locale env
Maybe it's safe to be called at: ProgramConfig::init()
?
like:
void ProgramConfig::init() {
brls::Logger::info("wiliwili {}", APPVersion::instance().git_tag);
+ // Needed for MPV
+ setlocale(LC_NUMERIC, "C");
// Set min_threads and max_threads of http thread pool
...
Done by: 87756ae
wayland下仍然存在问题,未设置LC_NUMERIC的情况下,加载视频播放页面崩溃。控制台输出:
Non-C locale detected. This is not supported.
Call 'setlocale(LC_NUMERIC, "C");' in your code.
00:54:28.464[ERROR] Fatal error: Error Create mpv Handle
terminate called after throwing an instance of 'std::logic_error'
what(): Error Create mpv Handle
[1] 1580249 IOT instruction (core dumped) wiliwili
@Eitetsu0 那你可以测试看看加在哪里可以,按文档的意思只要在初始化之前设置了就可以,我也不是很清楚为什么还会报错。
libmpv requires
LC_NUMERIC
to be "C": https://github.com/mpv-player/mpv/blob/ad02db8ceefc8cd8a52ea0cbeff0a18e80882c6f/libmpv/client.h#L147-L149But currently it depends on a XIM bugfix on X11 (https://github.com/xfangfang/glfw/blob/36ff2b3588aa2b745a59bc4f2a7b522cc21a220a/src/x11_init.c#L1262-L1267), and it doesn't reset in Wayland, causing a crash.