Skip to content

Commit 6e86fa7

Browse files
committed
Use L1T3 for screen sharing
1 parent ee8bb72 commit 6e86fa7

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Sources/LiveKit/Support/Utils.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,14 @@ class Utils: Loggable {
223223
let videoCodec = overrideVideoCodec ?? publishOptions.preferredCodec
224224

225225
if let videoCodec, videoCodec.isSVC {
226-
// SVC mode
227-
log("Using SVC mode")
228-
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)]
226+
// VP9/AV1 with screen sharing requires single spatial layer
227+
if isScreenShare {
228+
log("Using SVC mode with L1T3 for screen sharing")
229+
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L1T3)]
230+
} else {
231+
log("Using SVC mode")
232+
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)]
233+
}
229234
} else if !publishOptions.simulcast {
230235
// Not-simulcast mode
231236
log("Simulcast not enabled")

Sources/LiveKit/Types/ScalabilityMode.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ public enum ScalabilityMode: Int {
2121
case L3T3 = 1
2222
case L3T3_KEY = 2
2323
case L3T3_KEY_SHIFT = 3
24+
case L1T3 = 4
2425
}
2526

2627
public extension ScalabilityMode {
2728
static func fromString(_ rawString: String?) -> ScalabilityMode? {
2829
switch rawString {
30+
case "L1T3": .L1T3
2931
case "L3T3": .L3T3
3032
case "L3T3_KEY": .L3T3_KEY
3133
case "L3T3_KEY_SHIFT": .L3T3_KEY_SHIFT
@@ -35,13 +37,19 @@ public extension ScalabilityMode {
3537

3638
var rawStringValue: String {
3739
switch self {
40+
case .L1T3: "L1T3"
3841
case .L3T3: "L3T3"
3942
case .L3T3_KEY: "L3T3_KEY"
4043
case .L3T3_KEY_SHIFT: "L3T3_KEY_SHIFT"
4144
}
4245
}
4346

44-
var spatial: Int { 3 }
47+
var spatial: Int {
48+
switch self {
49+
case .L1T3: 1
50+
case .L3T3, .L3T3_KEY, .L3T3_KEY_SHIFT: 3
51+
}
52+
}
4553

4654
var temporal: Int { 3 }
4755
}

0 commit comments

Comments
 (0)