Skip to content

Commit cb566a0

Browse files
committed
fix: Do not probe if the ideal layers are already selected.
1 parent 6f53a5e commit cb566a0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

jvb/src/main/kotlin/org/jitsi/videobridge/cc/BandwidthProbing.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class BandwidthProbing(
9292

9393
// How much padding do we need?
9494
val totalNeededBps = bitrateControllerStatus.currentIdealBps - bitrateControllerStatus.currentTargetBps
95-
if (totalNeededBps < 1) {
95+
if (totalNeededBps < 1 || !bitrateControllerStatus.hasNonIdealLayer) {
9696
// Don't need to send any probing.
9797
bytesLeftOver = 0
9898
zeroStats()

jvb/src/main/kotlin/org/jitsi/videobridge/cc/allocation/BitrateController.kt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ class BitrateController<T : MediaSourceContainer> @JvmOverloads constructor(
196196
var totalTargetBitrate = 0.bps
197197
var totalIdealBitrate = 0.bps
198198
val activeSsrcs = mutableSetOf<Long>()
199+
var hasNonIdealLayer = false
199200

200201
val nowMs = clock.instant().toEpochMilli()
201202
val allocation = bandwidthAllocator.allocation
@@ -216,14 +217,19 @@ class BitrateController<T : MediaSourceContainer> @JvmOverloads constructor(
216217
allocationIdealBitrate?.let {
217218
totalIdealBitrate += it
218219
}
220+
221+
if (singleAllocation.idealLayer != null && singleAllocation.idealLayer != singleAllocation.targetLayer) {
222+
hasNonIdealLayer = true
223+
}
219224
}
220225

221226
activeSsrcs.removeIf { it < 0 }
222227

223228
return BitrateControllerStatusSnapshot(
224229
currentTargetBps = totalTargetBitrate.bps.toLong(),
225230
currentIdealBps = totalIdealBitrate.bps.toLong(),
226-
activeSsrcs = activeSsrcs
231+
activeSsrcs = activeSsrcs,
232+
hasNonIdealLayer = hasNonIdealLayer
227233
)
228234
}
229235

@@ -322,5 +328,6 @@ interface MediaSourceContainer {
322328
data class BitrateControllerStatusSnapshot(
323329
val currentTargetBps: Long = -1L,
324330
val currentIdealBps: Long = -1L,
325-
val activeSsrcs: Collection<Long> = emptyList()
331+
val activeSsrcs: Collection<Long> = emptyList(),
332+
val hasNonIdealLayer: Boolean
326333
)

0 commit comments

Comments
 (0)