Bound restored manual stream bitrate choices to 12 Mbit/s
This commit is contained in:
1 parent
390747343b
commit
d2f0828917
3 files changed
+4
-2
No files matched your search
@@ -14,6 +14,7 @@ data class StreamCaptureMode(val camera: String, val width: Int, val height: Int
|
||||
val minimumBitrate: Int = 1, val maximumBitrate: Int = Int.MAX_VALUE,
|
||||
val encoderProfile: Int? = videoCodec.profile) {
|
||||
val label get() = "${width}×${height} · $fps fps"
|
||||
val manualBitrateRange get() = minimumBitrate..minOf(maximumBitrate, 12_000_000)
|
||||
}
|
||||
data class StreamCamera(val id: String, val lens: LensOption, val modes: List<StreamCaptureMode>)
|
||||
|
||||
|
||||
@@ -13,5 +13,5 @@ data class StreamCaptureConfig(val mode: StreamCaptureMode, val orientation: Str
|
||||
val bitrate get() = videoBitrate ?: mode.bitrate
|
||||
init { require(bitrate in mode.minimumBitrate..mode.maximumBitrate) }
|
||||
fun withMode(next: StreamCaptureMode) = copy(mode = next,
|
||||
videoBitrate = videoBitrate?.coerceIn(next.minimumBitrate, next.maximumBitrate))
|
||||
videoBitrate = videoBitrate?.takeUnless { next.manualBitrateRange.isEmpty() }?.coerceIn(next.manualBitrateRange))
|
||||
}
|
||||
@@ -18,7 +18,8 @@ data class StreamCaptureSettings(val camera: String = "", val width: Int = 1280,
|
||||
LogManager.addLog("WARN", "stream", "capture settings: camera=${selected.id} has no available mode"); return null
|
||||
}
|
||||
val orientation = StreamOrientation.values().firstOrNull { it.degrees == rotation } ?: StreamOrientation.LEFT
|
||||
val restored = StreamCaptureConfig(mode, orientation, bitrate?.coerceIn(mode.minimumBitrate, mode.maximumBitrate))
|
||||
val restored = StreamCaptureConfig(mode, orientation,
|
||||
bitrate?.takeUnless { mode.manualBitrateRange.isEmpty() }?.coerceIn(mode.manualBitrateRange))
|
||||
if (camera.isNotEmpty() && (camera != mode.camera || width != mode.width || height != mode.height || fps != mode.fps ||
|
||||
codec != mode.videoCodec.id || rotation != orientation.degrees || bitrate != restored.videoBitrate))
|
||||
LogManager.addLog("WARN", "stream", "capture settings adjusted: saved=$this restored=$restored")
|
||||
|
||||
Reference in new issue
Block a user