diff --git a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift index bfe4d06aed..4926928e93 100644 --- a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift @@ -3601,7 +3601,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { for attribute in qualityFile.media.attributes { if case let .Video(_, _, _, _, _, videoCodec) = attribute, let videoCodec { qualityDebugText += " \(videoCodec)" - if videoCodec == "av1" { + if videoCodec == "av1" || videoCodec == "av01" { qualityDebugText += isHardwareAv1Supported ? " (HW)" : " (SW)" } } diff --git a/submodules/MediaPlayer/Sources/ChunkMediaPlayerV2.swift b/submodules/MediaPlayer/Sources/ChunkMediaPlayerV2.swift index e4a07fc426..3496ab7fb3 100644 --- a/submodules/MediaPlayer/Sources/ChunkMediaPlayerV2.swift +++ b/submodules/MediaPlayer/Sources/ChunkMediaPlayerV2.swift @@ -39,7 +39,7 @@ public final class ChunkMediaPlayerV2: ChunkMediaPlayer { func load() { let reader: MediaDataReader - if self.mediaType == .video && self.codecName == "av1" && isHardwareAv1Supported { + if self.mediaType == .video && (self.codecName == "av1" || self.codecName == "av01") && isHardwareAv1Supported { reader = AVAssetVideoDataReader(filePath: self.tempFile.path, isVideo: self.mediaType == .video) } else { reader = FFMpegMediaDataReader(filePath: self.tempFile.path, isVideo: self.mediaType == .video, codecName: self.codecName) diff --git a/submodules/MediaPlayer/Sources/MediaDataReader.swift b/submodules/MediaPlayer/Sources/MediaDataReader.swift index ba4fe1c150..2230c09e71 100644 --- a/submodules/MediaPlayer/Sources/MediaDataReader.swift +++ b/submodules/MediaPlayer/Sources/MediaDataReader.swift @@ -28,7 +28,7 @@ final class FFMpegMediaDataReader: MediaDataReader { if self.isVideo { var passthroughDecoder = true - if codecName == "av1" && !isHardwareAv1Supported { + if (codecName == "av1" || codecName == "av01") && !isHardwareAv1Supported { passthroughDecoder = false } let videoSource = SoftwareVideoReader(path: filePath, hintVP9: false, passthroughDecoder: passthroughDecoder) diff --git a/submodules/TelegramUniversalVideoContent/Sources/HLSVideoContent.swift b/submodules/TelegramUniversalVideoContent/Sources/HLSVideoContent.swift index 23a24b4e12..a4c83ff509 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/HLSVideoContent.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/HLSVideoContent.swift @@ -25,7 +25,20 @@ public struct HLSCodecConfiguration { public extension HLSCodecConfiguration { init(context: AccountContext) { - self.init(isSoftwareAv1Supported: false) + var isSoftwareAv1Supported = false + + var length: Int = 4 + var cpuCount: UInt32 = 0 + sysctlbyname("hw.ncpu", &cpuCount, &length, nil, 0) + if cpuCount >= 6 { + isSoftwareAv1Supported = true + } + + if let data = context.currentAppConfiguration.with({ $0 }).data, let value = data["ios_enable_software_av1"] as? Double { + isSoftwareAv1Supported = value != 0.0 + } + + self.init(isSoftwareAv1Supported: isSoftwareAv1Supported) } } @@ -48,7 +61,7 @@ public final class HLSQualitySet { currentCodec = videoCodec } } - if let currentCodec, currentCodec == "av1" { + if let currentCodec, (currentCodec == "av1" || currentCodec == "av01") { } else { qualityFiles[key] = baseFile.withMedia(alternativeFile) } diff --git a/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift b/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift index 9c6141f181..7f9475662e 100644 --- a/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift +++ b/submodules/TelegramUniversalVideoContent/Sources/NativeVideoContent.swift @@ -64,7 +64,7 @@ public final class NativeVideoContent: UniversalVideoContent { return true } - if videoCodec == "av1" { + if videoCodec == "av1" || videoCodec == "av01" { if isHardwareAv1Supported { return true } else {