From 4e4e80af845f1238e9c2cdfed8bbc6f5b3b952c0 Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Fri, 29 Sep 2023 01:21:43 +0800 Subject: [PATCH] Fix vp9 svc encode failed for screenshare (#882) --- .changeset/silver-swans-build.md | 5 +++++ src/room/participant/LocalParticipant.ts | 4 ++++ src/room/track/options.ts | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/silver-swans-build.md diff --git a/.changeset/silver-swans-build.md b/.changeset/silver-swans-build.md new file mode 100644 index 0000000000..8e5a508401 --- /dev/null +++ b/.changeset/silver-swans-build.md @@ -0,0 +1,5 @@ +--- +'livekit-client': patch +--- + +Fix vp9 svc failed for screenshare diff --git a/src/room/participant/LocalParticipant.ts b/src/room/participant/LocalParticipant.ts index 9535df83ff..d05dcd8669 100644 --- a/src/room/participant/LocalParticipant.ts +++ b/src/room/participant/LocalParticipant.ts @@ -682,6 +682,10 @@ export default class LocalParticipant extends Participant { // for svc codecs, disable simulcast and use vp8 for backup codec if (track instanceof LocalVideoTrack) { if (isSVCCodec(opts.videoCodec)) { + // vp9 svc with screenshare has problem to encode, always use L1T3 here + if (track.source === Track.Source.ScreenShare && opts.videoCodec === 'vp9') { + opts.scalabilityMode = 'L1T3'; + } // set scalabilityMode to 'L3T3_KEY' by default opts.scalabilityMode = opts.scalabilityMode ?? 'L3T3_KEY'; } diff --git a/src/room/track/options.ts b/src/room/track/options.ts index 32d84c9bc7..cb274f4c51 100644 --- a/src/room/track/options.ts +++ b/src/room/track/options.ts @@ -298,9 +298,9 @@ export function isCodecEqual(c1: string | undefined, c2: string | undefined): bo } /** - * scalability modes for svc, only supprot l3t3 now. + * scalability modes for svc. */ -export type ScalabilityMode = 'L3T3' | 'L3T3_KEY'; +export type ScalabilityMode = 'L1T3' | 'L2T3' | 'L2T3_KEY' | 'L3T3' | 'L3T3_KEY'; export namespace AudioPresets { export const telephone: AudioPreset = {