Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a config option for default initial last n. #2095

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -35,7 +37,7 @@ data class AllocationSettings @JvmOverloads constructor(
val onStageSources: List<String> = emptyList(),
val selectedSources: List<String> = emptyList(),
val videoConstraints: Map<String, VideoConstraints> = 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
Expand All @@ -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)
}
}
}

/**
Expand All @@ -68,7 +76,7 @@ internal class AllocationSettingsWrapper(
*/
private var selectedSources = emptyList<String>()

internal var lastN: Int = -1
internal var lastN: Int = AllocationSettings.defaultInitialLastN

private var videoConstraints: Map<String, VideoConstraints> = emptyMap()

Expand Down
4 changes: 4 additions & 0 deletions jvb/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 (-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
# channel (limited to the configured value). If not set, receivers are not allowed to override BWE.
// assumed-bandwidth-limit = 10 Mbps
Expand Down
Loading