From 1c9081951aefe318713a06e9d035e98a5f15ee4e Mon Sep 17 00:00:00 2001 From: calebvetter <39844454+calebvetter@users.noreply.github.com> Date: Sat, 27 Jun 2026 14:42:01 -0700 Subject: [PATCH] Fix AFTKRT + HSL/TS + EAC3 7.1 playback issues (#1580) ## Description This is a targeting fix for a very specific bug: on Fire TV 4k Max (AFTKRT), and possibly others but untested, ExoPlayer can't play an HLS/TS stream that has 8-channel (7.1) EAC3 audio. Direct play is not affected (7.1 EAC3 plays fine), and fewer channels work fine (i.e. 5.1 EAC3) even in an HLS/TS wrapper. This bug + device is tracked in KnownDefects. If more models are tested and found to have the same issue, they can be added to the list. Top candidates are probably AFTKA and AFTKM since they are also in the models with HEVC DoVi/HDR10+ playback issues and so probably have similar underlying limitations, but I don't have those devices to test. The fix is to first allow the app to make a playback request to the server and receive the stream info Jellyfin has decided to send. Then it evaluates the settings and stream for the following: - Playback is using ExoPlayer - Device is in the modelsWithEac3HlsPassthroughBug list (currently only AFTKRT) - Stream is not direct play - Stream is HLS with MPEG-TS container - Audio is 8-channel EAC3 We have to use a two-request fix because we don't know what Jellyfin is going to decide for the stream until we receive it. That way normal playable streams aren't getting overwritten by the fix when they shouldn't be. So the only streams that get the two request path applied is the exact fix for this bug. To apply post-playback-info fixes (including this one) a helper file was created PostPlaybackInfoFixes. In the future, if there are more bugs that can only be determined after the decided stream info is received, they can be added here. This keeps things logical and maintainable. ### Related issues The bug was able to be reproduced on multiple items with this exact scenario by simply playing back the item (making sure ExoPlayer is set as the default player in settings). ### Testing Tested on the target device: Amazon Fire TV 4k Max (2nd Gen), model AFTKRT. The following media was tested: - ExoPlayer, multiple titles with HEVC, EAC3 7.1 copied into HLS/TS (all failed, only processing 1-2fps) - Direct play of the same titles (works) - EAC3 5.1, HLS, MPEG-TS (works) - MPV with failing titles (works) The following device and settings were tested and had no effect on the above media results, ruling out external connections and settings: - HDMI to an LG TV, both connected to a soundbar via ARC, and disconnected using internal speakers - HDMI to a Dell computer monitor - Fire TV Settings > Display & Sound > Audio > Surround Sound > all 4 settings tested (Best Available, PCM, Dolby Digital Plus, Dolby Digital) ## AI or LLM usage Codex was used to debug the issue, create the initial change, and do iterative testing on the device to narrow the scope. The code was then carefully reviewed and I made structural decisions so everything fits well within the project's established conventions, removing bloat, added comments and kept it targeted, clear and maintainable. --- .../wholphin/util/profile/DeviceProfileUtils.kt | 13 +++++++++++++ .../wholphin/util/profile/KnownDefects.kt | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/app/src/main/java/com/github/damontecres/wholphin/util/profile/DeviceProfileUtils.kt b/app/src/main/java/com/github/damontecres/wholphin/util/profile/DeviceProfileUtils.kt index 2de5310e..a18d1805 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/util/profile/DeviceProfileUtils.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/util/profile/DeviceProfileUtils.kt @@ -203,6 +203,19 @@ fun createDeviceProfile( } // / Codec profiles + // Prevent 8-channel EAC3 passthrough in TS on certain devices + if (KnownDefects.eac3HlsPassthroughBug && Codec.Audio.EAC3 in allowedAudioCodecs) { + codecProfile { + type = CodecType.VIDEO_AUDIO + container = Codec.Container.TS + codec = Codec.Audio.EAC3 + + conditions { + ProfileConditionValue.AUDIO_CHANNELS lowerThanOrEquals 7 + } + } + } + // H264 profile codecProfile { type = CodecType.VIDEO diff --git a/app/src/main/java/com/github/damontecres/wholphin/util/profile/KnownDefects.kt b/app/src/main/java/com/github/damontecres/wholphin/util/profile/KnownDefects.kt index a4cd60c4..d2a3c042 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/util/profile/KnownDefects.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/util/profile/KnownDefects.kt @@ -14,6 +14,14 @@ private val modelsWithDoViHdr10PlusBug = "AFTKM", // Amazon Fire TV 4K (2nd Gen) ) +/** + * List of device models with known playback issues when 8-channel EAC3 is copied into MPEG-TS. + */ +private val modelsWithEac3TsPassthroughBug = + listOf( + "AFTKRT", // Amazon Fire TV 4K Max (2nd Gen) + ) + /** * List of device models that support H264 Hi10P 5.2, but don't advertise it * @@ -30,5 +38,6 @@ private val modelsWithHi10P52Support = object KnownDefects { val hevcDoviHdr10PlusBug = Build.MODEL in modelsWithDoViHdr10PlusBug + val eac3HlsPassthroughBug = Build.MODEL in modelsWithEac3TsPassthroughBug val supportsHi10P52 = Build.MODEL in modelsWithHi10P52Support }