Skip to content

Commit 9a10a92

Browse files
authored
Use L1T3 for screen sharing (#858)
Mirroring JS (and Flutter) workaround for: ```cpp if (codec.mode == VideoCodecMode::kScreensharing) { // TODO(bugs.webrtc.org/11999): Compose names of the structures when they // are implemented. return nullptr; // ← Returns nullptr regardless of flexible mode! } ``` 100% reproducible.
1 parent ee8bb72 commit 9a10a92

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.changes/screensharing-vp9

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
patch type="fixed" "Screen sharing not publishing frames with VP9/AV1 codecs"

Sources/LiveKit/Support/Utils.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ class Utils: Loggable {
225225
if let videoCodec, videoCodec.isSVC {
226226
// SVC mode
227227
log("Using SVC mode")
228-
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)]
228+
// VP9/AV1 with screen sharing requires single spatial layer
229+
return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: isScreenShare ? .L1T3 : .L3T3_KEY)]
229230
} else if !publishOptions.simulcast {
230231
// Not-simulcast mode
231232
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)