xfangfang / wiliwili

第三方B站客户端,目前可以运行在PC全平台、PSVita、PS4 、Xbox 和 Nintendo Switch上
https://xfangfang.github.io/wiliwili
GNU General Public License v3.0
3.11k stars 145 forks source link

今天更新系统后,wiliwili点击视频崩溃 #209

Closed Eitetsu0 closed 9 months ago

Eitetsu0 commented 10 months ago

重新编译了一遍还是一样。 是依赖更新了接口吗?求适配。

14:42:25.704[INFO] CURRENT_DESKTOP: DEFAULT
14:42:25.705[INFO] wiliwili
14:42:25.705[INFO] Current working directory: /home/z
14:42:25.705[INFO] client: 31954761.1679724699/6a2293b3-537b-6186-d257-1e47a81af578
14:42:25.705[INFO] cookie: DedeUserID:
14:42:25.705[INFO] cookie: DedeUserID__ckMd5:
14:42:25.705[INFO] cookie: SESSDATA:
14:42:25.705[INFO] cookie: bili_jct:
14:42:25.705[INFO] cookie: sid:
14:42:25.705[INFO] refreshToken: 
14:42:25.705[INFO] setting: {"app_theme":"dark","auto_next_part":true,"auto_next_recommend":false,"danmaku":true,"danmaku_filter_bottom":true,"danmaku_filter_color":true,"danmaku_filter_level":1,"danmaku_filter_scroll":true,"danmaku_filter_top":true,"danmaku_style_alpha":50,"danmaku_style_area":100,"danmaku_style_fontsize":30,"danmaku_style_line_height":120,"danmaku_style_speed":100,"fullscreen":false,"hide_bottom_bar":false,"hide_fps":false,"home_window_state":"0,2880x1766,0x0","keymap":"keyboard","player_default_speed":200,"player_exit_fullscreen_on_end":false,"player_hwdec":true,"player_hwdec_custom":"auto","player_inmemory_cache":500,"player_low_quality":false,"player_volume":100,"search_tv_mode":false,"video_codec":12,"video_format":1744,"video_quality":116}
14:42:25.705[INFO] Load config from: /home/z/.config/wiliwili/wiliwili_config.json
14:42:25.705[INFO] Load window state: 2880x1766,0x0
14:42:25.705[INFO] Set app locale: zh-Hans
14:42:25.807[INFO] Using platform GLFW
14:42:25.848[ERROR] GLFW 65548: Wayland: The platform does not support setting the window icon
14:42:25.848[ERROR] GLFW 65548: Wayland: The platform does not support setting the window position
14:42:25.849[INFO] glfw: GL Vendor: Intel
14:42:25.849[INFO] glfw: GL Renderer: Mesa Intel(R) Xe Graphics (TGL GT2)
14:42:25.849[INFO] glfw: GL Version: 4.6 (Core Profile) Mesa 23.2.1-arch1.1
14:42:25.849[INFO] glfw: GLFW Version: 3.4.0
14:42:25.853[ERROR] GLFW 65548: Wayland: The platform does not provide the window position
14:42:25.853[WARNING] Cannot find custom gamepad db, (Searched at: /home/z/.config/wiliwili/gamecontrollerdb.txt)
14:42:26.310[INFO] glfw: joystick 0 GUID 18000000f30400007c31000000010000
14:42:26.310[INFO] glfw: joystick 1 GUID 03000000321500005c00000011010000
14:42:26.310[INFO] glfw: joystick 2 GUID 03000000321500005c00000011010000
14:42:26.310[WARNING] Cannot find custom font, (Searched at: /home/z/.config/wiliwili/font.ttf)
14:42:26.310[INFO] Using internal font: /usr/share/wiliwili/resources/font/switch_font.ttf
14:42:26.314[INFO] Load emoji font: /usr/share/wiliwili/resources/font/emoji.ttf
14:42:26.314[INFO] Load keymap icon: /usr/share/wiliwili/resources/font/keymap_keyboard.ttf
14:42:26.314[INFO] createWindow done
14:42:26.427[INFO] Window size changed to 2880x1641, content size: 1280x785 factor: 2.25
14:42:26.427[INFO] scale factor: 1
14:42:26.710[INFO] max_thread_num: 4
14:42:28.922[INFO] App is up to date
Non-C locale detected. This is not supported.
Call 'setlocale(LC_NUMERIC, "C");' in your code.
14:42:30.331[ERROR] Fatal error: Error Create mpv Handle
terminate called after throwing an instance of 'std::logic_error'
  what():  Error Create mpv Handle
[1]    17208 IOT instruction (core dumped)  wiliwili
xfangfang commented 10 months ago

Non-C locale detected. This is not supported. Call 'setlocale(LC_NUMERIC, "C");' in your code.

跟着报错操作吧,可以试试在主函数里加个 setlocale(LC_NUMERIC, "C");,应该和你的系统更新相关。

Eitetsu0 commented 10 months ago

在main函数开头加了,没有效果。 不过我又在环境变量里设置了LC_NUMERIC=C ,正常了😹。

可是以前一直都没特意设置过这个环境变量,一直是系统根据LANG自动设置的 LC_NUMERIC="zh_CN.UTF-8" ,好奇怪。

Eitetsu0 commented 9 months ago

看了 https://github.com/xfangfang/wiliwili/issues/236 我觉得把这个重开一下吧,有进展我发这里

xfangfang commented 9 months ago

我在mac上测试,新增的那条语句是完全可以使用的,比如:
将其改为 setlocale(LC_NUMERIC, "zh_CN.GB2312"); 软件就无法正常开启。

你可以在 utils/config_helper.cpp 中做如下修改来测试

+static bool check_locale(void)
+{
+    char *name = setlocale(LC_NUMERIC, NULL);
+    if (name) {
+        brls::Logger::info("{}", name);
+    }
+    return !name || strcmp(name, "C") == 0 || strcmp(name, "C.UTF-8") == 0;
+}

void ProgramConfig::init() {
    brls::Logger::info("wiliwili {}", APPVersion::instance().git_tag);

+    brls::Logger::info("check_locale1: {}", check_locale());
    // Needed for MPV
    setlocale(LC_NUMERIC, "C");
+    brls::Logger::info("check_locale2: {}", check_locale());

如果测试说这里的设置都是正确的,那么问题可能来源于创建窗口的过程中被某个依赖库修改了,那可以尝试将 setlocale 放到 MPVCore::init() 中:

void MPVCore::init() {
+    setlocale(LC_NUMERIC, "C");
    this->mpv = mpv_create();
Eitetsu0 commented 9 months ago

按楼上加的测试是正常的

16:45:28.611[INFO] CURRENT_DESKTOP: DEFAULT
16:45:28.612[INFO] wiliwili
16:45:28.612[INFO] C
16:45:28.612[INFO] check_locale1: true
16:45:28.612[INFO] C
16:45:28.612[INFO] check_locale2: true

但是wayland环境下仍然会像1楼一样的报错。 ps:cmake参数加 -DGLFW_BUILD_WAYLAND=ON -DGLFW_BUILD_X11=OFF

在x11下,现在这个setlocale是起作用的,不会崩溃。

xfangfang commented 9 months ago

@Eitetsu0 我上面的最后一段话,“如果在MPVCore::init()里面进行测试还是一样的吗?”

Eitetsu0 commented 9 months ago

这个暂时还没试。这几天得了重感冒,刚刚又被拉医院来挂水了。。我晚上回去再试一下。在 2023年11月24日,16:55,xfangfang @.***> 写道: @Eitetsu0 我上面的最后一段话,“如果在MPVCore::init()里面进行测试还是一样的吗?”

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

xfangfang commented 9 months ago

好的,还是身体要紧,先好好休息。 对于这个问题我感觉加在mpv init里应该就能解决了

Eitetsu0 commented 9 months ago

MPVCore::init() 里试了一下,可以正常播放了。:ok_hand:

xfangfang commented 9 months ago

感谢反馈,我稍后调整一下就行啦,那这个issue先关闭了