diff --git a/.changes/screensharing-vp9 b/.changes/screensharing-vp9 new file mode 100644 index 000000000..a806792c9 --- /dev/null +++ b/.changes/screensharing-vp9 @@ -0,0 +1 @@ +patch type="fixed" "Screen sharing not publishing frames with VP9/AV1 codecs" \ No newline at end of file diff --git a/Sources/LiveKit/Support/Utils.swift b/Sources/LiveKit/Support/Utils.swift index 35685e0db..327b162fe 100644 --- a/Sources/LiveKit/Support/Utils.swift +++ b/Sources/LiveKit/Support/Utils.swift @@ -225,7 +225,8 @@ class Utils: Loggable { if let videoCodec, videoCodec.isSVC { // SVC mode log("Using SVC mode") - return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: .L3T3_KEY)] + // VP9/AV1 with screen sharing requires single spatial layer + return [RTC.createRtpEncodingParameters(encoding: encoding, scalabilityMode: isScreenShare ? .L1T3 : .L3T3_KEY)] } else if !publishOptions.simulcast { // Not-simulcast mode log("Simulcast not enabled") diff --git a/Sources/LiveKit/Types/ScalabilityMode.swift b/Sources/LiveKit/Types/ScalabilityMode.swift index 4e2e894d0..e947a0b57 100644 --- a/Sources/LiveKit/Types/ScalabilityMode.swift +++ b/Sources/LiveKit/Types/ScalabilityMode.swift @@ -21,11 +21,13 @@ public enum ScalabilityMode: Int { case L3T3 = 1 case L3T3_KEY = 2 case L3T3_KEY_SHIFT = 3 + case L1T3 = 4 } public extension ScalabilityMode { static func fromString(_ rawString: String?) -> ScalabilityMode? { switch rawString { + case "L1T3": .L1T3 case "L3T3": .L3T3 case "L3T3_KEY": .L3T3_KEY case "L3T3_KEY_SHIFT": .L3T3_KEY_SHIFT @@ -35,13 +37,19 @@ public extension ScalabilityMode { var rawStringValue: String { switch self { + case .L1T3: "L1T3" case .L3T3: "L3T3" case .L3T3_KEY: "L3T3_KEY" case .L3T3_KEY_SHIFT: "L3T3_KEY_SHIFT" } } - var spatial: Int { 3 } + var spatial: Int { + switch self { + case .L1T3: 1 + case .L3T3, .L3T3_KEY, .L3T3_KEY_SHIFT: 3 + } + } var temporal: Int { 3 } }