From e1be6af41b98433ba4f174e96d0075f41b810488 Mon Sep 17 00:00:00 2001 From: cloudwebrtc Date: Tue, 12 Dec 2023 13:04:59 +0800 Subject: [PATCH] remove enableBackupCodec for VideoPublishOptions. --- example/lib/pages/connect.dart | 4 ++-- lib/src/options.dart | 5 ----- lib/src/participant/local.dart | 7 +------ 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/example/lib/pages/connect.dart b/example/lib/pages/connect.dart index c3630ce1..a7aa29be 100644 --- a/example/lib/pages/connect.dart +++ b/example/lib/pages/connect.dart @@ -142,7 +142,7 @@ class _ConnectPageState extends State { preferredCodec = _preferredCodec; } - bool enableBackUpCodec = ['VP9', 'AV1'].contains(preferredCodec); + bool enableBackupVideoCodec = ['VP9', 'AV1'].contains(preferredCodec); // create new room final room = Room( @@ -155,7 +155,7 @@ class _ConnectPageState extends State { defaultVideoPublishOptions: VideoPublishOptions( simulcast: _simulcast, videoCodec: preferredCodec, - enableBackupCodec: enableBackUpCodec, + backupVideoCodec: enableBackupVideoCodec ? BackupVideoCodec() : null, ), defaultScreenShareCaptureOptions: const ScreenShareCaptureOptions( useiOSBroadcastExtension: true, diff --git a/lib/src/options.dart b/lib/src/options.dart index cadc0da3..f554c485 100644 --- a/lib/src/options.dart +++ b/lib/src/options.dart @@ -201,8 +201,6 @@ class VideoPublishOptions { final String? scalabilityMode; - final bool enableBackupCodec; - final BackupVideoCodec? backupVideoCodec; const VideoPublishOptions({ @@ -212,7 +210,6 @@ class VideoPublishOptions { this.videoSimulcastLayers = const [], this.screenShareSimulcastLayers = const [], this.name, - this.enableBackupCodec = true, this.backupVideoCodec, this.scalabilityMode, }); @@ -223,7 +220,6 @@ class VideoPublishOptions { List? videoSimulcastLayers, List? screenShareSimulcastLayers, String? videoCodec, - bool? enableBackupCodec, BackupVideoCodec? backupVideoCodec, String? scalabilityMode, }) => @@ -234,7 +230,6 @@ class VideoPublishOptions { screenShareSimulcastLayers: screenShareSimulcastLayers ?? this.screenShareSimulcastLayers, videoCodec: videoCodec ?? this.videoCodec, - enableBackupCodec: enableBackupCodec ?? this.enableBackupCodec, backupVideoCodec: backupVideoCodec ?? this.backupVideoCodec, scalabilityMode: scalabilityMode ?? this.scalabilityMode, ); diff --git a/lib/src/participant/local.dart b/lib/src/participant/local.dart index 732f5cd3..546dffe9 100644 --- a/lib/src/participant/local.dart +++ b/lib/src/participant/local.dart @@ -210,12 +210,7 @@ class LocalParticipant extends Participant { ), ]; - if (publishOptions.enableBackupCodec == true && - publishOptions.backupVideoCodec == null) { - publishOptions.copyWith(backupVideoCodec: BackupVideoCodec()); - } - - if (publishOptions.enableBackupCodec == true && + if (publishOptions.backupVideoCodec != null && publishOptions.backupVideoCodec!.codec != publishOptions.videoCodec) { simulcastCodecs.add(lk_rtc.SimulcastCodec( codec: publishOptions.backupVideoCodec!.codec.toLowerCase(),