* chore: e2ee.

* update.

* update.

* update.

* update.

* chore: Use feat/frame-encryption branch of flutter-webrtc.

* chore: Add E2EEKEY defines for dart environment, and e2ee switch.

* Add encodedInsertableStreams to RTCConfiguration.

* update.

* feat: Add e2ee indicator for Participant.

* feat: add e2ee worker js for flutter web.

* dart format.

* remove unused file.

* fix flutter analyze .

* update.

* update.

* add: indicate for decryption failure, and string key.

* remove .lock files.

* update.

* update.

* update e2ee.worker for web.

* feat: support setCodecPreferences.

* state TrackE2EEStateEvent.

* fix wrong import interface from dart_webrtc.

* update.

* update.

* update.

* update.

* update pubspec.lock.

* chore: update protocol and add EncryptionType for Participant.

* Update lib/src/e2ee/options.dart

Co-authored-by: Théo Monnom <[email protected]>

* fix typo.

* revert changes for internal import.

* Add _cleanUp() for previous room.

* Add e2ee supports detection method for native/web.

* Remove redundant overriding methods.

* dart format.

* Add e2ee.worker code and deployment docs.

* chore: remove duplicate words.

* chore: using Pbkdf2 derive the key.

* Update pubspec.yaml

* fix e2ee for safari.

* fix key length.

* update e2ee.worker.dart.js.

* fix.

* update proto.

* update.

* chore: add simulate for rachetKey.

* update.

* chore: key ratchet for flutter web.

* update.

* update.

* update.

* chore: key ratchet export for web.

* bump version for xframeworks.

* update.

* chore: some changes for key safety ratcheting.

* update.

* fix typo.

* update.

* rename.

* magic bytes for web.

* bump version for flutter-webrtc.

* fix analyzer.

---------

Co-authored-by: Théo Monnom <[email protected]>
This commit is contained in:
CloudWebRTC
2023-04-27 17:54:32 +08:00
committed by GitHub
co-authored by Théo Monnom
parent 3407221fc4
commit 26947e96d6
42 changed files with 12523 additions and 39 deletions
+35
View File
@@ -12,6 +12,7 @@ import '../options.dart';
import '../proto/livekit_models.pb.dart' as lk_models;
import '../proto/livekit_rtc.pb.dart' as lk_rtc;
import '../publication/local.dart';
import '../support/platform.dart';
import '../track/local/audio.dart';
import '../track/local/local.dart';
import '../track/local/video.dart';
@@ -182,6 +183,40 @@ class LocalParticipant extends Participant<LocalTrackPublication> {
init: transceiverInit,
);
if (lkBrowser() != BrowserType.firefox) {
var videoCodec = publishOptions.videoCodec.toLowerCase();
var caps = await rtc.getRtpSenderCapabilities('video');
List<rtc.RTCRtpCodecCapability> matched = [];
List<rtc.RTCRtpCodecCapability> partialMatched = [];
List<rtc.RTCRtpCodecCapability> unmatched = [];
for (var c in caps.codecs!) {
var codec = c.mimeType.toLowerCase();
if (codec == 'audio/opus') {
matched.add(c);
continue;
}
var matchesVideoCodec = codec == 'video/$videoCodec';
if (!matchesVideoCodec) {
unmatched.add(c);
continue;
}
if (publishOptions.videoCodec == 'h264') {
if (c.sdpFmtpLine != null &&
c.sdpFmtpLine!.contains('profile-level-id=42e01f')) {
matched.add(c);
} else {
partialMatched.add(c);
}
continue;
}
matched.add(c);
}
matched.addAll([...partialMatched, ...unmatched]);
await track.transceiver?.setCodecPreferences(matched);
track.codec = videoCodec;
}
// prefer to maintainResolution for screen share
if (track.source == TrackSource.screenShareVideo) {
var sender = track.transceiver!.sender;
+11 -3
View File
@@ -2,6 +2,7 @@ import 'package:collection/collection.dart';
import 'package:meta/meta.dart';
import '../core/room.dart';
import '../e2ee/options.dart';
import '../events.dart';
import '../extensions.dart';
import '../logger.dart';
@@ -9,12 +10,9 @@ import '../managers/event.dart';
import '../proto/livekit_models.pb.dart' as lk_models;
import '../publication/track_publication.dart';
import '../support/disposable.dart';
import '../track/local/local.dart';
import '../track/track.dart';
import '../types/other.dart';
import '../types/participant_permissions.dart';
import 'local.dart';
import 'remote.dart';
/// Represents a Participant in the room, notifies changes via delegates as
/// well as ChangeNotifier/providers.
@@ -94,6 +92,16 @@ abstract class Participant<T extends TrackPublication>
// Must be implemented by child class.
List<T> get audioTracks;
EncryptionType get firstTrackEncryptionType {
if (hasAudio) {
return audioTracks.first.encryptionType;
} else if (hasVideo) {
return videoTracks.first.encryptionType;
} else {
return EncryptionType.kNone;
}
}
@internal
bool get hasInfo => _participantInfo != null;