Skip to content

Commit b835995

Browse files
authored
fix: Enable E2EE for VP9 codec (#953)
### Problem While using the Flutter SDK with JS SDK and with E2EE enabled, the video from Web can not be decrypted by the Flutter app. ## Summary Enables end-to-end encryption (E2EE) for VP9 codec. Previously, E2EE was skipped for all SVC codecs. This aligns the Flutter SDK with the JS SDK, where E2EE works with VP9 codec. ## Changes Removed `isSVCCodec()` and use `isAV1Codec()` to enable E2EE setup for VP9 codec in `LocalTrackPublishedEvent` handler Removed `isSVCCodec()` and use `isAV1Codec()` to enable E2EE setup for VP9 codec in `TrackSubscribedEvent` handler Is there any specific reason why E2EE is disabled for SVC codecs? I tried VP9 with this patch and the VP9 video from Web can be decrypted by Flutter app.
1 parent db96f8f commit b835995

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

lib/src/e2ee/e2ee_manager.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class E2EEManager {
4747
_listener!
4848
..on<LocalTrackPublishedEvent>((event) async {
4949
if (event.publication.encryptionType == EncryptionType.kNone ||
50-
isSVCCodec(event.publication.track?.codec ?? '')) {
50+
isAV1Codec(event.publication.track?.codec ?? '')) {
5151
// no need to setup frame cryptor
5252
return;
5353
}
@@ -81,7 +81,7 @@ class E2EEManager {
8181
})
8282
..on<TrackSubscribedEvent>((event) async {
8383
final codec = event.publication.mimeType.split('/')[1];
84-
if (event.publication.encryptionType == EncryptionType.kNone || isSVCCodec(codec)) {
84+
if (event.publication.encryptionType == EncryptionType.kNone || isAV1Codec(codec)) {
8585
// no need to setup frame cryptor
8686
return;
8787
}

lib/src/utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@ const refreshSubscribedCodecAfterNewCodec = 5000;
567567

568568
bool isSVCCodec(String codec) => ['vp9', 'av1'].contains(codec.toLowerCase());
569569

570+
bool isAV1Codec(String codec) => codec.toLowerCase() == 'av1';
571+
570572
class ScalabilityMode {
571573
late num spatial;
572574

0 commit comments

Comments
 (0)