cxfksword / MPVKit

mpv library for iOS, macOS, tvOS applications
GNU General Public License v3.0
71 stars 19 forks source link

tvOS leaving app and reentering cause video to freeze. #23

Open zmartell opened 2 months ago

zmartell commented 2 months ago

Hi,

I noticed that in simulator its ok, but not on a real tvOS device, if you have a video playing, press "back" or "home" and then go back into the app, the video freezes but the audio continues.

It seems to break vulkan when its no longer focus. Is there a way to reinitialise?

You can test it out with demo.

  1. Play one of the sample videos
  2. press back/home.
  3. open app again
  4. see video frozen but audio continues.

Some logs I captured:

Playing ok.. [af] v: [convert] 48000Hz stereo 2ch floatp [af] v: [convert] (disabled) [af] v: [out] 48000Hz stereo 2ch floatp [lavf] debug: stream 1: resize index to 128 [cplayer] v: audio ready [cplayer] v: starting audio playback

"press BACK/home".. and then...

Snapshot request 0x303fa8360 complete with error: <NSError: 0x303f98360; domain: BSActionErrorDomain; code: 1 ("response-not-possible")> Snapshot request 0x303f86eb0 complete with error: <NSError: 0x303f9b120; domain: BSActionErrorDomain; code: 1 ("response-not-possible")> Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) [mvk-error] VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueueSubmit MTLCommandBuffer on Queue 0-0" execution failed (code 7): Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) [mvk-error] VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueueSubmit MTLCommandBuffer on Queue 0-0" execution failed (code 7): Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) Execution of the command buffer was aborted due to an error during execution. Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) [mvk-error] VK_ERROR_DEVICE_LOST: MTLCommandBuffer "vkQueuePresentKHR MTLCommandBuffer on Queue 0-0" execution failed (code 7): Insufficient Permission (to submit GPU work from background) (00000006:kIOGPUCommandBufferCallbackErrorBackgroundExecutionNotPermitted) [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] v: Detected fps ratio 0.0000 exceeds threshold 0.0000, re-enabling interpolation [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [ffmpeg/video] error: h264: Failed to decode frame (invalid session, -12903) [ffmpeg/video] error: h264: hardware accelerator failed to decode picture [vd] warn: Error while decoding frame (hardware decoding)! [ffmpeg/video] debug: h264: VideoToolbox decoder needs reconfig, restarting.. [ffmpeg/video] warn: h264: vt decoder cb: output image buffer is null: -12909 [ffmpeg/video] error: h264: hardware accelerator failed to decode picture [vd] warn: Error while decoding frame (hardware decoding)! [ffmpeg/video] debug: h264: VideoToolbox decoder needs reconfig, restarting.. [ffmpeg/video] warn: h264: vt decoder cb: output image buffer is null: -12909 [ffmpeg/video] error: h264: hardware accelerator failed to decode picture [vd] warn: Error while decoding frame (hardware decoding)! [vd] warn: Attempting next decoding method after failure of h264-videotoolbox. [vd] debug: Skipping previously attempted hwdec: h264-videotoolbox [vd] v: Using software decoding. [vd] v: Detected 6 logical cores. [vd] v: Requesting 7 threads for decoding. [ffmpeg/video] debug: h264: Reinit context to 720x480, pix_fmt: yuv420p [vd] debug: DR parameter change to 720x482 yuv420p align=64 [vd] debug: Allocating new (host-cached) DR image... [vo/gpu-next/libplacebo] debug: Allocating 2375808 memory of type 0xf (id 1) in heap 0: unknown [vo/gpu-next/libplacebo] debug: Spent 0.083 ms allocating slab [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [ffmpeg/video] error: h264: co located POCs unavailable [vd] debug: Allocating new (host-cached) DR image... [ffmpeg/video] error: h264: mmco: unref short failure [vd] debug: Allocating new (host-cached) DR image... [vo/gpu-next/libplacebo] debug: Allocating 4751616 memory of type 0xf (id 1) in heap 0: unknown [vo/gpu-next/libplacebo] debug: Spent 0.068 ms allocating slab [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [vd] debug: Allocating new (host-cached) DR image... [lavf] debug: stream 0: resize index to 128 [vd] v: Decoder format: 720x480 [32:27] yuv420p auto/auto/auto/auto/auto CL=mpeg2/4/h264 crop=720x480+0+0 [vd] v: Using container aspect ratio. [vd] v: Forcing user-set aspect ratio. [vf] v: [in] 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [vf] v: [userdeint] 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [vf] v: [autorotate] 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [vf] v: [convert] 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [autoconvert] v: Sub-filter requires draining but we must destroy it now. event: video-reconfig [convert] v: dropping frame due to pin disconnect [vf] v: [convert] (disabled) [vf] v: [out] 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [vo/gpu-next/libplacebo] debug: Discontinuous source PTS jump 26.568208 -> 32.949583 [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [cplayer] info: VO: [gpu-next] 720x480 => 853x480 yuv420p [cplayer] v: VO: Description: Video output based on libplacebo event: video-reconfig [vo/gpu-next] v: reconfig to 720x480 [32:27] yuv420p bt.601/bt.601-525/bt.1886/limited/display CL=mpeg2/4/h264 crop=720x480+0+0 [vo/gpu-next] v: Window size: 1920x1080 (Borders: l=0 t=0 r=0 b=0) [vo/gpu-next] v: Video source: 720x480 (32:27) [vo/gpu-next] v: Video display: (0, 0) 720x480 -> (0, 0) 1920x1080 [vo/gpu-next] v: Video scale: 2.666667/2.250000 [vo/gpu-next] v: OSD borders: l=0 t=0 r=0 b=0 [vo/gpu-next] v: Video borders: l=0 t=0 r=0 b=0 [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST I ENTEREED FOREGROUND [vo/gpu-next/libplacebo] debug: Non monotonically increasing PTS 32.949583 -> 32.949583 [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vd] debug: Allocating new (host-cached) DR image... [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vo/gpu-next/libplacebo] error: Failed acquiring swapchain image: VK_ERROR_DEVICE_LOST [vd] debug: Allocating new (host-cached) DR image... [vo/gpu-next/libplacebo] debug: Allocating 9503232 memory of type 0xf (id 1) in heap 0: unknown [vo/gpu-next/libplacebo] debug: Spent 0.475 ms allocating slab

cxfksword commented 2 months ago

This is a known issue and currently there is no good workaround.