open-ani / animeko

一站式在线弹幕追番平台:全自动 BT + 在线多数据源聚合,离线缓存,Bangumi 收藏同步,弹幕云过滤 ... 100% Kotlin Compose Multiplatform
https://myani.org
GNU Affero General Public License v3.0
1.99k stars 61 forks source link

VLCJ 缓冲 BT 时可能冻结 UI #1220

Closed Him188 closed 5 days ago

Him188 commented 1 week ago

问题描述

以下问题都是这导致的:

To blame: me.him188.ani.app.videoplayer.io.SeekableInputCallbackMedia

https://github.com/open-ani/animeko/blob/b80b6c5080d850380724e5980cd74870856f8452/app/shared/video-player/src/desktopMain/kotlin/io/SeekableInputCallbackMedia.kt#L18-L23

input.read 会调用 TorrentInput.read, which 会 runBlocking:

https://github.com/open-ani/animeko/blob/d9d21421dc4732744a59576f820763941d66176b/torrent/api/src/jvmMain/kotlin/TorrentInput.jvm.kt#L99-L114

导致任何对 VLCJ player 的销毁操作都需要等待此 blocking.

需要加一个 coroutine scope 来在执行 VLC close 之前停止 scope, 中断 runBlocking.

复现步骤

No response

Ani 版本号

4.0.0

操作系统

macOS (Intel), macOS (M 系列芯片), Windows

应用日志

Him188 commented 5 days ago

Image

pause 在了这里