Keep codec mode probes consistent with live encoding
This commit is contained in:
1 parent
7be4b8884c
commit
c0d5db318f
3 files changed
+36
-17
No files matched your search
@@ -290,20 +290,22 @@ internal class CallVideoCodec(requested: CallVideoFormat, bitrate: Int, val name
|
||||
var profiles = 0; var pipeline = 0; var maximumLevel = 0
|
||||
for (profile in listOf(1, 2)) {
|
||||
try {
|
||||
val level = if (type.id == 1) { if (size.width > 1280) 40 else 31 }
|
||||
else if (size.width > 1280 || profile == 2) 120 else 93
|
||||
var profilePipeline = 0
|
||||
for (portrait in listOf(false, true)) {
|
||||
val w = if (portrait) size.height else size.width; val h = if (portrait) size.width else size.height
|
||||
check(caps.videoCapabilities?.areSizeAndRateSupported(w, h, 30.0) == true) { "Decoder geometry unsupported: ${w}x$h" }
|
||||
val f = CallVideoFormat(1, w, h, codec = type.id, level = level, profile = profile)
|
||||
val key = checkNotNull(CallVideoNative.probeKey(type.id, profile, w, h))
|
||||
validateKey(key, f)
|
||||
profilePipeline = maxOf(profilePipeline, verifyDecode(f, List(8) { Packet(1_000_000L + it * 33333, true, key) },
|
||||
entry.name, true))
|
||||
}
|
||||
profiles = profiles or profile; maximumLevel = maxOf(maximumLevel, level)
|
||||
pipeline = maxOf(pipeline, profilePipeline)
|
||||
val level = if (type.id == 1) { if (size.width > 1280) 40 else 31 }
|
||||
else if (size.width > 1280 || profile == 2) 120 else 93
|
||||
var profilePipeline = 0
|
||||
for (portrait in listOf(false, true)) {
|
||||
val w = if (portrait) size.height else size.width; val h = if (portrait) size.width else size.height
|
||||
check(caps.videoCapabilities?.areSizeAndRateSupported(w, h, 30.0) == true) {
|
||||
"Decoder geometry unsupported: ${w}x$h"
|
||||
}
|
||||
val f = CallVideoFormat(1, w, h, codec = type.id, level = level, profile = profile)
|
||||
val key = checkNotNull(CallVideoNative.probeKey(type.id, profile, w, h))
|
||||
validateKey(key, f)
|
||||
profilePipeline = maxOf(profilePipeline,
|
||||
verifyDecode(f, List(8) { Packet(1_000_000L + it * 33333, true, key) }, entry.name, true))
|
||||
}
|
||||
profiles = profiles or profile; maximumLevel = maxOf(maximumLevel, level)
|
||||
pipeline = maxOf(pipeline, profilePipeline)
|
||||
} catch (e: Exception) {
|
||||
LogManager.addLog("WARN", "call", "video decoder profile probe rejected name=${entry.name} " +
|
||||
"codec=${type.id} profile=$profile size=$size: ${e.message}")
|
||||
|
||||
Reference in new issue
Block a user