使用Xcode View Hierarchy等阻碍主线程渲染的工具或代码会使Metal渲染卡顿或黑屏#87
Conversation
|
这次提交是想优化做动画等其他改变渲染view尺寸导致metal闪一帧粉红色画面的问题,比如你曾经提的 #66 里的视频 |
没看出来,可能只有一帧,不太好识别。 目前不仅是Xcode View Hierarchy存在此问题,lookin等也会,比较奇怪。 |
…velop * 'develop' of https://github.com/debugly/fsplayer: extract frame_queue_flush_readable method upgrade version to 1.0.7 bump version to 1.0.6 rm unused parameter 'attach' fix HEIC tile-grid: unlock overlay before checking pending status update CHANGELOG fix subtitle missing issue debugly#33 when playback rate not equal 1.0 not auto drop audio Improve the iso judgment fix ass force set marginV style fault audio: add fallback for pcm_dvd with unspecified params fix heic snapshot, not support FSSnapshotTypeOrigin add tile grid rendering functions for HEIC hw playback fix HEIC tile grid display size and padding handling Each draw needs its own argument buffer snapshot add HEIC tile grid playback support fix: guard AVERROR_HTTP_TOO_MANY_REQUESTS for ffmpeg 7
…velop * 'ffmpeg8' of https://github.com/debugly/fsplayer: use ffmpeg8 compatible with ffmpeg 5,6,7,8 compatible with ffmpeg 8 ffmpeg6 can use av_packet_side_data_get disable tile grid heic feature when use ffmpeg 6 support zlist (first line not host,every line is a full url)
|
我也遇到了,特别是横屏竖屏切换后,卡顿,黑屏,问了gemini,codex,claude都没解决,claude说FSPlayer 用的是 Metal 渲染(FSMetalView),它的绘制由一个跑在【主线程】上的 DisplayLink 驱动,每一帧都要调 CAMetalLayer nextDrawable 去申请一块画布。而 nextDrawable 会阻塞等待一个信号量(semaphore_timedwait)。 |
FSPlayer |
复现步骤:

① 运行iOS FSPlayerDemo
② 在主页使用Xcode View Hierarchy调试工具,如下图所示:
③ 关闭Xcode View Hierarchy,进入FSPlayer播放页面即可复现,此时画面大概率黑屏或者卡顿,在App运行期间内都会这样,除非重启App
④
[commandBuffer presentDrawable:drawable atTime:currentAttach.presentationTime]更换为[commandBuffer presentDrawable:drawable];能解决此问题,但尚未研究原因Tips:真机和模拟器均可以复现,但建议使用真机调试