From 36a307cd7f3aaf98c0f8b6f1603b46dbed763144 Mon Sep 17 00:00:00 2001 From: Joseph Price Date: Sat, 10 Aug 2024 17:39:53 +0100 Subject: [PATCH] Really don't request HEVC if unsupported (cherry picked from commit c7a4c89b74abccdcd3f91785f678bc51ae74185c) --- .../org/jellyfin/androidtv/util/profile/ExoPlayerProfile.kt | 3 ++- .../org/jellyfin/androidtv/util/profile/ProfileHelper.kt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/jellyfin/androidtv/util/profile/ExoPlayerProfile.kt b/app/src/main/java/org/jellyfin/androidtv/util/profile/ExoPlayerProfile.kt index 12d478a04..4ced9180a 100644 --- a/app/src/main/java/org/jellyfin/androidtv/util/profile/ExoPlayerProfile.kt +++ b/app/src/main/java/org/jellyfin/androidtv/util/profile/ExoPlayerProfile.kt @@ -11,6 +11,7 @@ import org.jellyfin.androidtv.util.profile.ProfileHelper.max1080pProfileConditio import org.jellyfin.androidtv.util.profile.ProfileHelper.maxAudioChannelsCodecProfile import org.jellyfin.androidtv.util.profile.ProfileHelper.photoDirectPlayProfile import org.jellyfin.androidtv.util.profile.ProfileHelper.subtitleProfile +import org.jellyfin.androidtv.util.profile.ProfileHelper.supportsHevc import org.jellyfin.apiclient.model.dlna.CodecProfile import org.jellyfin.apiclient.model.dlna.CodecType import org.jellyfin.apiclient.model.dlna.DeviceProfile @@ -76,7 +77,7 @@ class ExoPlayerProfile( this.context = EncodingContext.Streaming container = Codec.Container.TS videoCodec = buildList { - if (deviceHevcCodecProfile.ContainsCodec(Codec.Video.HEVC, Codec.Container.TS)) add(Codec.Video.HEVC) + if (supportsHevc) add(Codec.Video.HEVC) add(Codec.Video.H264) }.joinToString(",") audioCodec = when (downMixAudio) { diff --git a/app/src/main/java/org/jellyfin/androidtv/util/profile/ProfileHelper.kt b/app/src/main/java/org/jellyfin/androidtv/util/profile/ProfileHelper.kt index 0e31a7ea3..b92ed091f 100644 --- a/app/src/main/java/org/jellyfin/androidtv/util/profile/ProfileHelper.kt +++ b/app/src/main/java/org/jellyfin/androidtv/util/profile/ProfileHelper.kt @@ -63,13 +63,17 @@ object ProfileHelper { } } + val supportsHevc by lazy { + MediaTest.supportsHevc() + } + val deviceHevcCodecProfile by lazy { CodecProfile().apply { type = CodecType.Video codec = Codec.Video.HEVC conditions = when { - !MediaTest.supportsHevc() -> { + !supportsHevc -> { // The following condition is a method to exclude all HEVC Timber.i("*** Does NOT support HEVC") arrayOf(