Skip to content

Commit

Permalink
feat: Split config for default constraints. (#2252)
Browse files Browse the repository at this point in the history
* feat: Split config for default constraints.

* squash: Use the correct property.
  • Loading branch information
bgrozev authored Nov 14, 2024
1 parent 94fb805 commit 847cb3e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal class AllocationSettingsWrapper(

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

private var defaultConstraints: VideoConstraints = VideoConstraints(config.thumbnailMaxHeightPx)
private var defaultConstraints: VideoConstraints = VideoConstraints(config.defaultMaxHeightPx)

private var assumedBandwidthBps: Long = -1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ internal class BandwidthAllocator<T : MediaSourceContainer>(
addHandler(eventHandler)
}

/**
* The allocations settings signalled by the receiver.
*/
/** The allocations settings signalled by the receiver. */
private var allocationSettings =
AllocationSettings(defaultConstraints = VideoConstraints(BitrateControllerConfig.config.thumbnailMaxHeightPx))
AllocationSettings(
defaultConstraints = VideoConstraints(BitrateControllerConfig.config.initialMaxHeightPx)
)

/**
* The last time [BandwidthAllocator.update] was called.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ class BitrateControllerConfig private constructor() {
"videobridge.cc.bwe-change-threshold".from(JitsiConfig.newConfig)
}

/**
* The max resolution to allocate for the thumbnails.
*/
val thumbnailMaxHeightPx: Int by config {
"org.jitsi.videobridge.THUMBNAIL_MAX_HEIGHT".from(JitsiConfig.legacyConfig)
val initialMaxHeightPx: Int by config {
// Support the old property name if the user has overridden it.
"videobridge.cc.thumbnail-max-height-px".from(JitsiConfig.newConfig)
.softDeprecated("use videobridge.cc.initial-max-height-px")
"videobridge.cc.initial-max-height-px".from(JitsiConfig.newConfig)
}
val defaultMaxHeightPx: Int by config {
// Support the old property name if the user has overridden it.
"videobridge.cc.thumbnail-max-height-px".from(JitsiConfig.newConfig)
.softDeprecated("use videobridge.cc.default-max-height-px")
"videobridge.cc.default-max-height-px".from(JitsiConfig.newConfig)
}

/**
Expand Down
6 changes: 5 additions & 1 deletion jvb/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ videobridge {
# How often we check endpoint's connectivity status
check-interval = 500 milliseconds
}
# Congestion Control
cc {
bwe-change-threshold = 0.15
thumbnail-max-height-px = 180
# The default constraint to use if the receiver signals ReceiverConstraints with missing defaultConstraints.
default-max-height-px = 180
# The constraint to use for the initial allocation, before the receiver has signaled ReceiverConstraints.
initial-max-height-px = 180
onstage-preferred-height-px = 360
onstage-preferred-framerate = 30
// Whether the bridge is allowed to oversend (send the lowest layer regardless of BWE) for on-stage endpoints. If
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.shouldBe
import org.jitsi.nlj.MediaSourceDesc
import org.jitsi.nlj.VideoType
import org.jitsi.videobridge.cc.config.BitrateControllerConfig

fun testSource(endpointId: String, sourceName: String, videoType: VideoType = VideoType.CAMERA): MediaSourceDesc {
return MediaSourceDesc(
Expand All @@ -44,7 +43,7 @@ class EffectiveConstraintsTest : ShouldSpec() {
val s5 = testSource("e1", "s5", videoType = VideoType.DISABLED)
val s6 = testSource("e1", "s6", videoType = VideoType.DISABLED)

val defaultConstraints = VideoConstraints(BitrateControllerConfig.config.thumbnailMaxHeightPx)
val defaultConstraints = VideoConstraints(180)

val sources = listOf(s1, s2, s3, s4, s5, s6)
val zeroEffectiveConstraints = mutableMapOf(
Expand Down

0 comments on commit 847cb3e

Please sign in to comment.