mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
AV1 handling
This commit is contained in:
parent
7fb53dbd79
commit
e3e331c2cd
@ -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)"
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ public final class NativeVideoContent: UniversalVideoContent {
|
||||
return true
|
||||
}
|
||||
|
||||
if videoCodec == "av1" {
|
||||
if videoCodec == "av1" || videoCodec == "av01" {
|
||||
if isHardwareAv1Supported {
|
||||
return true
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user