From 2d8d17616008b7c75a6ba552997d0caa6f6187f9 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 6 May 2021 23:56:08 -0500 Subject: [PATCH] Disable reference frame invalidation on tvOS and always enable HEVC (for now) Reference frame invalidation seems to trigger a renderer hang on tvOS 14.5 in my testing. Since we don't have RFI to bias us toward H.264, let's use HEVC all the time now. This may change again if the RFI issues are sorted out (perhaps we need to implement blocking waits for invalidated frames?) --- Limelight/Stream/Connection.m | 13 +++++++++++-- Moonlight TV/Settings.bundle/Root.plist | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Limelight/Stream/Connection.m b/Limelight/Stream/Connection.m index 910b44f5..59e8a8b9 100644 --- a/Limelight/Stream/Connection.m +++ b/Limelight/Stream/Connection.m @@ -463,7 +463,11 @@ void ClConnectionStatusUpdate(int status) // to freeze after a few minutes with HEVC prior to iOS 11.3. // As a result, we will only use HEVC on iOS 11.3 or later. if (@available(iOS 11.3, tvOS 11.3, *)) { - _streamConfig.supportsHevc = config.allowHevc && VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC); + _streamConfig.supportsHevc = +#if !TARGET_OS_TV + config.allowHevc && +#endif + VTIsHardwareDecodeSupported(kCMVideoCodecType_HEVC); } // HEVC must be supported when HDR is enabled @@ -481,7 +485,12 @@ void ClConnectionStatusUpdate(int status) // RFI doesn't work properly with HEVC on iOS 11 with an iPhone SE (at least) // It doesnt work on macOS either, tested with Network Link Conditioner. - _drCallbacks.capabilities = CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC | + // RFI seems to be broken at all resolutions on the Apple TV 4K (1st gen) + // on tvOS 14.5. + _drCallbacks.capabilities = +#if !TARGET_OS_TV + CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC | +#endif CAPABILITY_DIRECT_SUBMIT; LiInitializeAudioCallbacks(&_arCallbacks); diff --git a/Moonlight TV/Settings.bundle/Root.plist b/Moonlight TV/Settings.bundle/Root.plist index 969f5a6e..49e2e792 100644 --- a/Moonlight TV/Settings.bundle/Root.plist +++ b/Moonlight TV/Settings.bundle/Root.plist @@ -156,7 +156,7 @@ Key useHevc DefaultValue - + Type