bug: ffplay 异常退出可导致关闭显示器的时间设置无效
Tofloor
poster avatar
duanyao
deepin
2018-06-28 04:34
Author
本帖最后由 duanyao 于 2018-6-27 20:37 编辑

版本:
deepin 15.6,6.27 更新到最新。不确定之前的版本是不是有这个问题。

ffplay 版本:库里的 ffmpeg 7:3.3.2-1

ffplay -v
ffplay version 3.3.2-1 Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-2) 20170724

步骤:
1. 打开“控制中心-电源管理-关闭显示器于”面板,调整时间,比如1分钟。
2. 用 ffplay 播放一个视频,例如命令行 ffplay xxx.mp4 。
3. 按 ctrl+c 关闭 ffplay,用 killall 也行。
4. 等待1分钟以上不操作。

实际结果:
显示器没有关闭。

期待的结果:
显示器关闭。

修复方法:
杀死 dde-session-daemon (它会自动重启)可以恢复正常。

相关日志:

ffplay 启动时,出现以下日志:

6月 27 20:12:02 duanyao-laptop daemon/screensaver[17361]: screensaver.go:176: SetTimeout to  0 0 false
6月 27 20:12:02 duanyao-laptop daemon/screensaver[17361]: screensaver.go:101: "My SDL application" want system enter inhibit, because: "laying a game"


按 ctrl+c 结束时则没有其它日志。

如果用鼠标关闭 ffplay 窗口,则出现额外的日志:

6月 27 20:23:53 duanyao-laptop com.deepin.daemon.Power[3044]: screensaver.go:123: "My SDL application" no need inhibit.
6月 27 20:23:53 duanyao-laptop com.deepin.daemon.Power[3044]: screensaver.go:127: Enter un-inhibit state
6月 27 20:23:53 duanyao-laptop com.deepin.daemon.Power[3044]: screensaver.go:176: SetTimeout to  60 0 false
6月 27 20:23:53 duanyao-laptop daemon/screensaver[17510]: screensaver.go:123: "My SDL application" no need inhibit.
6月 27 20:23:53 duanyao-laptop daemon/screensaver[17510]: screensaver.go:127: Enter un-inhibit state
6月 27 20:23:53 duanyao-laptop daemon/screensaver[17510]: screensaver.go:176: SetTimeout to  60 0 false


分析:

以上日志说明,ffplay 播放视频时禁用了定时熄屏(inhibit),它本该在退出时恢复熄屏(un-inhibit ),但在异常退出的情况下没能这样做,dde-session-daemon 就无法再定时熄屏了。重启 dde-session-daemon 可以重置这个状态。

dde-session-daemon实现了 d-bus 接口 org.freedesktop.ScreenSaver( https://people.freedesktop.org/~ ... tion-spec/re01.html ),按其规定,调用 Inhibit 方法的应用程序异常退出时,应该自动撤销禁用定时熄屏的状态,这样就不会出现应用异常退出导致无法熄屏的情况发生了。

https://people.freedesktop.org/~hadess/idle-inhibition-spec/ch03.html

Inhibition will stop when the UnInhibit function is called, or the application disconnects from the D-Bus session bus (which usually happens upon exit).

Reply Favorite View the author
All Replies
avatar
duanyao
deepin
2018-06-28 04:35
#1
Reply View the author
avatar
aida
deepin
2018-06-28 06:06
#2
Reply View the author
avatar
electricface
deepin
2018-06-29 02:59
#3
看来对 screensaver 规范实现的不完整
Reply View the author