mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
AV1 handling
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user