Skip to content
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 @@ -74,7 +74,7 @@ fun getEffectiveConstraints(
var sourcesWithNonZeroConstraints = 0

return sources.associateWith { source ->
if (sourcesWithNonZeroConstraints >= effectiveLastN) {
if (!source.videoType.isEnabled() || sourcesWithNonZeroConstraints >= effectiveLastN) {
VideoConstraints.NOTHING
} else {
allocationSettings.getConstraints(source.sourceName).also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class EffectiveConstraintsTest : ShouldSpec() {
val s3 = testSource("e1", "s3")
val s4 = testSource("e1", "s4", videoType = VideoType.DISABLED)
val s5 = testSource("e1", "s5", videoType = VideoType.DISABLED)
val s6 = testSource("e1", "s6", videoType = VideoType.DISABLED)
val s6 = testSource("e1", "s6", videoType = VideoType.NONE)

val defaultConstraints = VideoConstraints(180)

Expand Down Expand Up @@ -97,9 +97,7 @@ class EffectiveConstraintsTest : ShouldSpec() {
defaultConstraints = VideoConstraints.NOTHING,
videoConstraints = mapOf("s4" to VideoConstraints(720))
)
getEffectiveConstraints(sources, allocationSettings) shouldBe zeroEffectiveConstraints.apply {
put(s4, VideoConstraints(720))
}
getEffectiveConstraints(sources, allocationSettings) shouldBe zeroEffectiveConstraints
}
context("When the top sources have the video DISABLED") {
// The top sources in speaker order have videoType = DISABLED
Expand All @@ -108,7 +106,7 @@ class EffectiveConstraintsTest : ShouldSpec() {
context("With default settings") {
val allocationSettings = AllocationSettings(lastN = 1, defaultConstraints = defaultConstraints)
getEffectiveConstraints(sources, allocationSettings) shouldBe zeroEffectiveConstraints.apply {
put(s4, VideoConstraints(180))
put(s1, VideoConstraints(180))
}
}
context("With default constraints 0 and non-zero constraints for a source with video DISABLED") {
Expand All @@ -117,9 +115,7 @@ class EffectiveConstraintsTest : ShouldSpec() {
defaultConstraints = VideoConstraints.NOTHING,
videoConstraints = mapOf("s5" to VideoConstraints(180))
)
getEffectiveConstraints(sources, allocationSettings) shouldBe zeroEffectiveConstraints.apply {
put(s5, VideoConstraints(180))
}
getEffectiveConstraints(sources, allocationSettings) shouldBe zeroEffectiveConstraints
}
context("With default constraints 0 and non-zero constraints for a source with video enabled") {
val allocationSettings = AllocationSettings(
Expand Down Expand Up @@ -159,9 +155,9 @@ class EffectiveConstraintsTest : ShouldSpec() {
context("And default settings") {
val allocationSettings = AllocationSettings(lastN = 3, defaultConstraints = defaultConstraints)
getEffectiveConstraints(endpoints, allocationSettings) shouldBe zeroEffectiveConstraints.apply {
put(s4, VideoConstraints(180))
put(s5, VideoConstraints(180))
put(s6, VideoConstraints(180))
put(s1, VideoConstraints(180))
put(s2, VideoConstraints(180))
put(s3, VideoConstraints(180))
}
}
context("And non-zero constraints for sources down the list") {
Expand All @@ -175,7 +171,6 @@ class EffectiveConstraintsTest : ShouldSpec() {
)
)
getEffectiveConstraints(endpoints, allocationSettings) shouldBe zeroEffectiveConstraints.apply {
put(s6, VideoConstraints(180))
put(s2, VideoConstraints(180))
put(s3, VideoConstraints(180))
}
Expand Down