Committed by
GitHub
Update to m125 (#436)
* Fix compile errors with m125 * Update default encryption option values * Update webrtc to m125.6422.02 * spotless
正在显示
6 个修改的文件
包含
33 行增加
和
19 行删除
| 1 | /* | 1 | /* |
| 2 | - * Copyright 2023 LiveKit, Inc. | 2 | + * Copyright 2023-2024 LiveKit, Inc. |
| 3 | * | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. | 5 | * you may not use this file except in compliance with the License. |
| @@ -18,10 +18,12 @@ package io.livekit.android.e2ee | @@ -18,10 +18,12 @@ package io.livekit.android.e2ee | ||
| 18 | 18 | ||
| 19 | import livekit.LivekitModels.Encryption | 19 | import livekit.LivekitModels.Encryption |
| 20 | 20 | ||
| 21 | -var defaultRatchetSalt = "LKFrameEncryptionKey" | ||
| 22 | -var defaultMagicBytes = "LK-ROCKS" | ||
| 23 | -var defaultRatchetWindowSize = 0 | ||
| 24 | -var defaultFaultTolerance = -1 | 21 | +internal const val defaultRatchetSalt = "LKFrameEncryptionKey" |
| 22 | +internal const val defaultMagicBytes = "LK-ROCKS" | ||
| 23 | +internal const val defaultRatchetWindowSize = 16 | ||
| 24 | +internal const val defaultFailureTolerance = -1 | ||
| 25 | +internal const val defaultKeyRingSize = 16 | ||
| 26 | +internal const val defaultDiscardFrameWhenCryptorNotReady = false | ||
| 25 | 27 | ||
| 26 | class E2EEOptions | 28 | class E2EEOptions |
| 27 | constructor( | 29 | constructor( |
| @@ -30,7 +32,9 @@ constructor( | @@ -30,7 +32,9 @@ constructor( | ||
| 30 | defaultMagicBytes, | 32 | defaultMagicBytes, |
| 31 | defaultRatchetWindowSize, | 33 | defaultRatchetWindowSize, |
| 32 | true, | 34 | true, |
| 33 | - defaultFaultTolerance, | 35 | + defaultFailureTolerance, |
| 36 | + defaultKeyRingSize, | ||
| 37 | + defaultDiscardFrameWhenCryptorNotReady, | ||
| 34 | ), | 38 | ), |
| 35 | encryptionType: Encryption.Type = Encryption.Type.GCM, | 39 | encryptionType: Encryption.Type = Encryption.Type.GCM, |
| 36 | ) { | 40 | ) { |
| @@ -43,13 +43,14 @@ public interface KeyProvider { | @@ -43,13 +43,14 @@ public interface KeyProvider { | ||
| 43 | 43 | ||
| 44 | class BaseKeyProvider | 44 | class BaseKeyProvider |
| 45 | constructor( | 45 | constructor( |
| 46 | - private var ratchetSalt: String, | ||
| 47 | - private var uncryptedMagicBytes: String, | ||
| 48 | - private var ratchetWindowSize: Int, | 46 | + private var ratchetSalt: String = defaultRatchetSalt, |
| 47 | + private var uncryptedMagicBytes: String = defaultMagicBytes, | ||
| 48 | + private var ratchetWindowSize: Int = defaultRatchetWindowSize, | ||
| 49 | override var enableSharedKey: Boolean = true, | 49 | override var enableSharedKey: Boolean = true, |
| 50 | - private var failureTolerance: Int, | ||
| 51 | -) : | ||
| 52 | - KeyProvider { | 50 | + private var failureTolerance: Int = defaultFailureTolerance, |
| 51 | + private var keyRingSize: Int = defaultKeyRingSize, | ||
| 52 | + private var discardFrameWhenCryptorNotReady: Boolean = defaultDiscardFrameWhenCryptorNotReady, | ||
| 53 | +) : KeyProvider { | ||
| 53 | private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf() | 54 | private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf() |
| 54 | override fun setSharedKey(key: String, keyIndex: Int?): Boolean { | 55 | override fun setSharedKey(key: String, keyIndex: Int?): Boolean { |
| 55 | return rtcKeyProvider.setSharedKey(keyIndex ?: 0, key.toByteArray()) | 56 | return rtcKeyProvider.setSharedKey(keyIndex ?: 0, key.toByteArray()) |
| @@ -109,6 +110,8 @@ constructor( | @@ -109,6 +110,8 @@ constructor( | ||
| 109 | ratchetWindowSize, | 110 | ratchetWindowSize, |
| 110 | uncryptedMagicBytes.toByteArray(), | 111 | uncryptedMagicBytes.toByteArray(), |
| 111 | failureTolerance, | 112 | failureTolerance, |
| 113 | + keyRingSize, | ||
| 114 | + discardFrameWhenCryptorNotReady, | ||
| 112 | ) | 115 | ) |
| 113 | } | 116 | } |
| 114 | } | 117 | } |
| @@ -82,12 +82,10 @@ fun RTCConfiguration.copyFrom(config: RTCConfiguration) { | @@ -82,12 +82,10 @@ fun RTCConfiguration.copyFrom(config: RTCConfiguration) { | ||
| 82 | enableCpuOveruseDetection = config.enableCpuOveruseDetection | 82 | enableCpuOveruseDetection = config.enableCpuOveruseDetection |
| 83 | suspendBelowMinBitrate = config.suspendBelowMinBitrate | 83 | suspendBelowMinBitrate = config.suspendBelowMinBitrate |
| 84 | screencastMinBitrate = config.screencastMinBitrate | 84 | screencastMinBitrate = config.screencastMinBitrate |
| 85 | - combinedAudioVideoBwe = config.combinedAudioVideoBwe | ||
| 86 | networkPreference = config.networkPreference | 85 | networkPreference = config.networkPreference |
| 87 | sdpSemantics = config.sdpSemantics | 86 | sdpSemantics = config.sdpSemantics |
| 88 | turnCustomizer = config.turnCustomizer | 87 | turnCustomizer = config.turnCustomizer |
| 89 | activeResetSrtpParams = config.activeResetSrtpParams | 88 | activeResetSrtpParams = config.activeResetSrtpParams |
| 90 | - allowCodecSwitching = config.allowCodecSwitching | ||
| 91 | cryptoOptions = config.cryptoOptions | 89 | cryptoOptions = config.cryptoOptions |
| 92 | turnLoggingId = config.turnLoggingId | 90 | turnLoggingId = config.turnLoggingId |
| 93 | enableImplicitRollback = config.enableImplicitRollback | 91 | enableImplicitRollback = config.enableImplicitRollback |
| @@ -17,7 +17,17 @@ | @@ -17,7 +17,17 @@ | ||
| 17 | package io.livekit.android.webrtc | 17 | package io.livekit.android.webrtc |
| 18 | 18 | ||
| 19 | import io.livekit.android.util.LKLog | 19 | import io.livekit.android.util.LKLog |
| 20 | -import livekit.org.webrtc.* | 20 | +import livekit.org.webrtc.EglBase |
| 21 | +import livekit.org.webrtc.HardwareVideoEncoderFactory | ||
| 22 | +import livekit.org.webrtc.SimulcastVideoEncoderFactory | ||
| 23 | +import livekit.org.webrtc.SoftwareVideoEncoderFactory | ||
| 24 | +import livekit.org.webrtc.VideoCodecInfo | ||
| 25 | +import livekit.org.webrtc.VideoCodecStatus | ||
| 26 | +import livekit.org.webrtc.VideoEncoder | ||
| 27 | +import livekit.org.webrtc.VideoEncoderFactory | ||
| 28 | +import livekit.org.webrtc.VideoEncoderFallback | ||
| 29 | +import livekit.org.webrtc.VideoFrame | ||
| 30 | +import livekit.org.webrtc.WrappedNativeVideoEncoder | ||
| 21 | import java.util.concurrent.Callable | 31 | import java.util.concurrent.Callable |
| 22 | import java.util.concurrent.ExecutorService | 32 | import java.util.concurrent.ExecutorService |
| 23 | import java.util.concurrent.Executors | 33 | import java.util.concurrent.Executors |
| @@ -194,8 +204,8 @@ open class SimulcastVideoEncoderFactoryWrapper( | @@ -194,8 +204,8 @@ open class SimulcastVideoEncoderFactoryWrapper( | ||
| 194 | return future.get() | 204 | return future.get() |
| 195 | } | 205 | } |
| 196 | 206 | ||
| 197 | - override fun createNativeVideoEncoder(): Long { | ||
| 198 | - val future = executor.submit(Callable { return@Callable encoder.createNativeVideoEncoder() }) | 207 | + override fun createNative(webrtcEnvRef: Long): Long { |
| 208 | + val future = executor.submit(Callable { return@Callable encoder.createNative(webrtcEnvRef) }) | ||
| 199 | return future.get() | 209 | return future.get() |
| 200 | } | 210 | } |
| 201 | 211 |
| @@ -78,7 +78,6 @@ dependencies { | @@ -78,7 +78,6 @@ dependencies { | ||
| 78 | implementation libs.timber | 78 | implementation libs.timber |
| 79 | implementation libs.coroutines.lib | 79 | implementation libs.coroutines.lib |
| 80 | implementation libs.kotlinx.serialization.json | 80 | implementation libs.kotlinx.serialization.json |
| 81 | - api libs.webrtc | ||
| 82 | api libs.okhttp | 81 | api libs.okhttp |
| 83 | api libs.audioswitch | 82 | api libs.audioswitch |
| 84 | implementation libs.androidx.annotation | 83 | implementation libs.androidx.annotation |
-
请 注册 或 登录 后发表评论