From c522e7179f36c494744871ba660d67ef6aa3e837 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 13 Feb 2024 12:32:38 -0600 Subject: [PATCH 1/2] feat: Add a config option for default initial last n. --- .../videobridge/cc/allocation/AllocationSettings.kt | 12 ++++++++++-- jvb/src/main/resources/reference.conf | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/jvb/src/main/kotlin/org/jitsi/videobridge/cc/allocation/AllocationSettings.kt b/jvb/src/main/kotlin/org/jitsi/videobridge/cc/allocation/AllocationSettings.kt index 73ca5fb400..c9a1762e65 100644 --- a/jvb/src/main/kotlin/org/jitsi/videobridge/cc/allocation/AllocationSettings.kt +++ b/jvb/src/main/kotlin/org/jitsi/videobridge/cc/allocation/AllocationSettings.kt @@ -16,6 +16,8 @@ */ package org.jitsi.videobridge.cc.allocation +import org.jitsi.config.JitsiConfig +import org.jitsi.metaconfig.config import org.jitsi.nlj.util.bps import org.jitsi.utils.OrderedJsonObject import org.jitsi.utils.logging2.Logger @@ -35,7 +37,7 @@ data class AllocationSettings @JvmOverloads constructor( val onStageSources: List = emptyList(), val selectedSources: List = emptyList(), val videoConstraints: Map = emptyMap(), - val lastN: Int = -1, + val lastN: Int = defaultInitialLastN, val defaultConstraints: VideoConstraints, /** A non-negative value is assumed as the available bandwidth in bps. A negative value is ignored. */ val assumedBandwidthBps: Long = -1 @@ -52,6 +54,12 @@ data class AllocationSettings @JvmOverloads constructor( override fun toString(): String = toJson().toJSONString() fun getConstraints(endpointId: String) = videoConstraints.getOrDefault(endpointId, defaultConstraints) + + companion object { + val defaultInitialLastN: Int by config { + "videobridge.cc.initial-last-n".from(JitsiConfig.newConfig) + } + } } /** @@ -68,7 +76,7 @@ internal class AllocationSettingsWrapper( */ private var selectedSources = emptyList() - internal var lastN: Int = -1 + internal var lastN: Int = AllocationSettings.defaultInitialLastN private var videoConstraints: Map = emptyMap() diff --git a/jvb/src/main/resources/reference.conf b/jvb/src/main/resources/reference.conf index cb49a9d49a..373a99ad49 100644 --- a/jvb/src/main/resources/reference.conf +++ b/jvb/src/main/resources/reference.conf @@ -67,6 +67,10 @@ videobridge { # no last-n limit) jvb-last-n = -1 + // The initial value for the client-configured last-n setting. This applies before it is overriden by colibri or + // data channel signaling. + initial-last-n = -1 + # If set allows receivers to override bandwidth estimation (BWE) with a specific value signaled over the bridge # channel (limited to the configured value). If not set, receivers are not allowed to override BWE. // assumed-bandwidth-limit = 10 Mbps From f3f30699351fc8d21b81c9db766164d5038f5b16 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Tue, 13 Feb 2024 13:03:21 -0600 Subject: [PATCH 2/2] squash: Improve config description. --- jvb/src/main/resources/reference.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jvb/src/main/resources/reference.conf b/jvb/src/main/resources/reference.conf index 373a99ad49..7f6f6748e8 100644 --- a/jvb/src/main/resources/reference.conf +++ b/jvb/src/main/resources/reference.conf @@ -68,7 +68,7 @@ videobridge { jvb-last-n = -1 // The initial value for the client-configured last-n setting. This applies before it is overriden by colibri or - // data channel signaling. + // data channel signaling (-1 implies no last-n limit). initial-last-n = -1 # If set allows receivers to override bandwidth estimation (BWE) with a specific value signaled over the bridge