Committed by
GitHub
Update webrtc to 114.5735.03 (#267)
* update libwebrtc to 114.5735.02 * update to 114.5735.03
正在显示
13 个修改的文件
包含
97 行增加
和
39 行删除
| @@ -135,10 +135,11 @@ dokkaHtml { | @@ -135,10 +135,11 @@ dokkaHtml { | ||
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | dependencies { | 137 | dependencies { |
| 138 | + //api fileTree(dir: 'libs', include: ['*.jar']) | ||
| 138 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" | 139 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 139 | implementation deps.coroutines.lib | 140 | implementation deps.coroutines.lib |
| 140 | implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0' | 141 | implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0' |
| 141 | - api 'io.github.webrtc-sdk:android:104.5112.10' | 142 | + api 'io.github.webrtc-sdk:android:114.5735.03' |
| 142 | api "com.squareup.okhttp3:okhttp:4.10.0" | 143 | api "com.squareup.okhttp3:okhttp:4.10.0" |
| 143 | api 'com.github.davidliu:audioswitch:d18e3e31d427c27f1593030e024b370bf24480fd' | 144 | api 'com.github.davidliu:audioswitch:d18e3e31d427c27f1593030e024b370bf24480fd' |
| 144 | implementation "androidx.annotation:annotation:1.4.0" | 145 | implementation "androidx.annotation:annotation:1.4.0" |
| @@ -26,6 +26,9 @@ import javax.inject.Named | @@ -26,6 +26,9 @@ import javax.inject.Named | ||
| 26 | import javax.inject.Provider | 26 | import javax.inject.Provider |
| 27 | import javax.inject.Singleton | 27 | import javax.inject.Singleton |
| 28 | 28 | ||
| 29 | +/** | ||
| 30 | + * @suppress | ||
| 31 | + */ | ||
| 29 | @Module | 32 | @Module |
| 30 | object AudioHandlerModule { | 33 | object AudioHandlerModule { |
| 31 | 34 |
| @@ -21,6 +21,9 @@ import dagger.Provides | @@ -21,6 +21,9 @@ import dagger.Provides | ||
| 21 | import kotlinx.coroutines.Dispatchers | 21 | import kotlinx.coroutines.Dispatchers |
| 22 | import javax.inject.Named | 22 | import javax.inject.Named |
| 23 | 23 | ||
| 24 | +/** | ||
| 25 | + * @suppress | ||
| 26 | + */ | ||
| 24 | @Module | 27 | @Module |
| 25 | object CoroutinesModule { | 28 | object CoroutinesModule { |
| 26 | @Provides | 29 | @Provides |
| @@ -16,6 +16,9 @@ | @@ -16,6 +16,9 @@ | ||
| 16 | 16 | ||
| 17 | package io.livekit.android.dagger | 17 | package io.livekit.android.dagger |
| 18 | 18 | ||
| 19 | +/** | ||
| 20 | + * @suppress | ||
| 21 | + */ | ||
| 19 | object InjectionNames { | 22 | object InjectionNames { |
| 20 | 23 | ||
| 21 | /** | 24 | /** |
| @@ -42,6 +45,8 @@ object InjectionNames { | @@ -42,6 +45,8 @@ object InjectionNames { | ||
| 42 | 45 | ||
| 43 | internal const val OPTIONS_VIDEO_HW_ACCEL = "options_video_hw_accel" | 46 | internal const val OPTIONS_VIDEO_HW_ACCEL = "options_video_hw_accel" |
| 44 | 47 | ||
| 48 | + internal const val LIB_WEBRTC_INITIALIZATION = "lib_webrtc_initialization" | ||
| 49 | + | ||
| 45 | // Overrides | 50 | // Overrides |
| 46 | internal const val OVERRIDE_OKHTTP = "override_okhttp" | 51 | internal const val OVERRIDE_OKHTTP = "override_okhttp" |
| 47 | internal const val OVERRIDE_AUDIO_DEVICE_MODULE = "override_audio_device_module" | 52 | internal const val OVERRIDE_AUDIO_DEVICE_MODULE = "override_audio_device_module" |
| @@ -21,6 +21,9 @@ import dagger.Provides | @@ -21,6 +21,9 @@ import dagger.Provides | ||
| 21 | import dagger.Reusable | 21 | import dagger.Reusable |
| 22 | import kotlinx.serialization.json.Json | 22 | import kotlinx.serialization.json.Json |
| 23 | 23 | ||
| 24 | +/** | ||
| 25 | + * @suppress | ||
| 26 | + */ | ||
| 24 | @Module | 27 | @Module |
| 25 | object JsonFormatModule { | 28 | object JsonFormatModule { |
| 26 | @Provides | 29 | @Provides |
| @@ -21,6 +21,9 @@ import dagger.Provides | @@ -21,6 +21,9 @@ import dagger.Provides | ||
| 21 | import io.livekit.android.memory.CloseableManager | 21 | import io.livekit.android.memory.CloseableManager |
| 22 | import javax.inject.Singleton | 22 | import javax.inject.Singleton |
| 23 | 23 | ||
| 24 | +/** | ||
| 25 | + * @suppress | ||
| 26 | + */ | ||
| 24 | @Module | 27 | @Module |
| 25 | object MemoryModule { | 28 | object MemoryModule { |
| 26 | 29 |
| @@ -24,6 +24,9 @@ import io.livekit.android.LiveKitOverrides | @@ -24,6 +24,9 @@ import io.livekit.android.LiveKitOverrides | ||
| 24 | import javax.inject.Named | 24 | import javax.inject.Named |
| 25 | 25 | ||
| 26 | @SuppressLint("KotlinNullnessAnnotation") | 26 | @SuppressLint("KotlinNullnessAnnotation") |
| 27 | +/** | ||
| 28 | + * @suppress | ||
| 29 | + */ | ||
| 27 | @Module | 30 | @Module |
| 28 | class OverridesModule(private val overrides: LiveKitOverrides) { | 31 | class OverridesModule(private val overrides: LiveKitOverrides) { |
| 29 | 32 |
| @@ -37,8 +37,44 @@ import javax.inject.Singleton | @@ -37,8 +37,44 @@ import javax.inject.Singleton | ||
| 37 | 37 | ||
| 38 | typealias CapabilitiesGetter = @JvmSuppressWildcards (MediaStreamTrack.MediaType) -> RtpCapabilities | 38 | typealias CapabilitiesGetter = @JvmSuppressWildcards (MediaStreamTrack.MediaType) -> RtpCapabilities |
| 39 | 39 | ||
| 40 | +/** | ||
| 41 | + * @suppress | ||
| 42 | + */ | ||
| 40 | @Module | 43 | @Module |
| 41 | object RTCModule { | 44 | object RTCModule { |
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * Certain classes require libwebrtc to be initialized prior to use. | ||
| 48 | + */ | ||
| 49 | + @Provides | ||
| 50 | + @Singleton | ||
| 51 | + @Named(InjectionNames.LIB_WEBRTC_INITIALIZATION) | ||
| 52 | + fun libWebrtcInitialization(appContext: Context): LibWebrtcInitialization { | ||
| 53 | + PeerConnectionFactory.initialize( | ||
| 54 | + PeerConnectionFactory.InitializationOptions | ||
| 55 | + .builder(appContext) | ||
| 56 | + .setInjectableLogger({ s, severity, s2 -> | ||
| 57 | + if (!LiveKit.enableWebRTCLogging) { | ||
| 58 | + return@setInjectableLogger | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + val loggingLevel = when (severity) { | ||
| 62 | + Logging.Severity.LS_VERBOSE -> LoggingLevel.VERBOSE | ||
| 63 | + Logging.Severity.LS_INFO -> LoggingLevel.INFO | ||
| 64 | + Logging.Severity.LS_WARNING -> LoggingLevel.WARN | ||
| 65 | + Logging.Severity.LS_ERROR -> LoggingLevel.ERROR | ||
| 66 | + else -> LoggingLevel.OFF | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + LKLog.log(loggingLevel) { | ||
| 70 | + Timber.log(loggingLevel.toAndroidLogPriority(), "$s2: $s") | ||
| 71 | + } | ||
| 72 | + }, Logging.Severity.LS_VERBOSE) | ||
| 73 | + .createInitializationOptions() | ||
| 74 | + ) | ||
| 75 | + return LibWebrtcInitialization | ||
| 76 | + } | ||
| 77 | + | ||
| 42 | @Provides | 78 | @Provides |
| 43 | @Singleton | 79 | @Singleton |
| 44 | @JvmSuppressWildcards | 80 | @JvmSuppressWildcards |
| @@ -144,6 +180,9 @@ object RTCModule { | @@ -144,6 +180,9 @@ object RTCModule { | ||
| 144 | 180 | ||
| 145 | @Provides | 181 | @Provides |
| 146 | fun videoEncoderFactory( | 182 | fun videoEncoderFactory( |
| 183 | + @Suppress("UNUSED_PARAMETER") | ||
| 184 | + @Named(InjectionNames.LIB_WEBRTC_INITIALIZATION) | ||
| 185 | + webrtcInitialization: LibWebrtcInitialization, | ||
| 147 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) | 186 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) |
| 148 | videoHwAccel: Boolean, | 187 | videoHwAccel: Boolean, |
| 149 | eglContext: EglBase.Context, | 188 | eglContext: EglBase.Context, |
| @@ -164,6 +203,9 @@ object RTCModule { | @@ -164,6 +203,9 @@ object RTCModule { | ||
| 164 | 203 | ||
| 165 | @Provides | 204 | @Provides |
| 166 | fun videoDecoderFactory( | 205 | fun videoDecoderFactory( |
| 206 | + @Suppress("UNUSED_PARAMETER") | ||
| 207 | + @Named(InjectionNames.LIB_WEBRTC_INITIALIZATION) | ||
| 208 | + webrtcInitialization: LibWebrtcInitialization, | ||
| 167 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) | 209 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) |
| 168 | videoHwAccel: Boolean, | 210 | videoHwAccel: Boolean, |
| 169 | eglContext: EglBase.Context, | 211 | eglContext: EglBase.Context, |
| @@ -181,33 +223,13 @@ object RTCModule { | @@ -181,33 +223,13 @@ object RTCModule { | ||
| 181 | @Provides | 223 | @Provides |
| 182 | @Singleton | 224 | @Singleton |
| 183 | fun peerConnectionFactory( | 225 | fun peerConnectionFactory( |
| 184 | - appContext: Context, | 226 | + @Suppress("UNUSED_PARAMETER") |
| 227 | + @Named(InjectionNames.LIB_WEBRTC_INITIALIZATION) | ||
| 228 | + webrtcInitialization: LibWebrtcInitialization, | ||
| 185 | audioDeviceModule: AudioDeviceModule, | 229 | audioDeviceModule: AudioDeviceModule, |
| 186 | videoEncoderFactory: VideoEncoderFactory, | 230 | videoEncoderFactory: VideoEncoderFactory, |
| 187 | videoDecoderFactory: VideoDecoderFactory, | 231 | videoDecoderFactory: VideoDecoderFactory, |
| 188 | ): PeerConnectionFactory { | 232 | ): PeerConnectionFactory { |
| 189 | - PeerConnectionFactory.initialize( | ||
| 190 | - PeerConnectionFactory.InitializationOptions | ||
| 191 | - .builder(appContext) | ||
| 192 | - .setInjectableLogger({ s, severity, s2 -> | ||
| 193 | - if (!LiveKit.enableWebRTCLogging) { | ||
| 194 | - return@setInjectableLogger | ||
| 195 | - } | ||
| 196 | - | ||
| 197 | - val loggingLevel = when (severity) { | ||
| 198 | - Logging.Severity.LS_VERBOSE -> LoggingLevel.VERBOSE | ||
| 199 | - Logging.Severity.LS_INFO -> LoggingLevel.INFO | ||
| 200 | - Logging.Severity.LS_WARNING -> LoggingLevel.WARN | ||
| 201 | - Logging.Severity.LS_ERROR -> LoggingLevel.ERROR | ||
| 202 | - else -> LoggingLevel.OFF | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - LKLog.log(loggingLevel) { | ||
| 206 | - Timber.log(loggingLevel.toAndroidLogPriority(), "$s2: $s") | ||
| 207 | - } | ||
| 208 | - }, Logging.Severity.LS_VERBOSE) | ||
| 209 | - .createInitializationOptions() | ||
| 210 | - ) | ||
| 211 | return PeerConnectionFactory.builder() | 233 | return PeerConnectionFactory.builder() |
| 212 | .setAudioDeviceModule(audioDeviceModule) | 234 | .setAudioDeviceModule(audioDeviceModule) |
| 213 | .setVideoEncoderFactory(videoEncoderFactory) | 235 | .setVideoEncoderFactory(videoEncoderFactory) |
| @@ -226,4 +248,9 @@ object RTCModule { | @@ -226,4 +248,9 @@ object RTCModule { | ||
| 226 | @Provides | 248 | @Provides |
| 227 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) | 249 | @Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL) |
| 228 | fun videoHwAccel() = true | 250 | fun videoHwAccel() = true |
| 229 | -} | ||
| 251 | +} | ||
| 252 | + | ||
| 253 | +/** | ||
| 254 | + * @suppress | ||
| 255 | + */ | ||
| 256 | +object LibWebrtcInitialization |
| @@ -29,6 +29,9 @@ import java.util.concurrent.TimeUnit | @@ -29,6 +29,9 @@ import java.util.concurrent.TimeUnit | ||
| 29 | import javax.inject.Named | 29 | import javax.inject.Named |
| 30 | import javax.inject.Singleton | 30 | import javax.inject.Singleton |
| 31 | 31 | ||
| 32 | +/** | ||
| 33 | + * @suppress | ||
| 34 | + */ | ||
| 32 | @Module | 35 | @Module |
| 33 | object WebModule { | 36 | object WebModule { |
| 34 | @Provides | 37 | @Provides |
| @@ -5,16 +5,21 @@ import livekit.LivekitModels.Encryption | @@ -5,16 +5,21 @@ import livekit.LivekitModels.Encryption | ||
| 5 | var defaultRatchetSalt = "LKFrameEncryptionKey" | 5 | var defaultRatchetSalt = "LKFrameEncryptionKey" |
| 6 | var defaultMagicBytes = "LK-ROCKS" | 6 | var defaultMagicBytes = "LK-ROCKS" |
| 7 | var defaultRatchetWindowSize = 16 | 7 | var defaultRatchetWindowSize = 16 |
| 8 | +var defaultFaultTolerance = -1 | ||
| 8 | 9 | ||
| 9 | class E2EEOptions | 10 | class E2EEOptions |
| 10 | -constructor(keyProvider: KeyProvider = BaseKeyProvider( | ||
| 11 | - defaultRatchetSalt, | ||
| 12 | - defaultMagicBytes, | ||
| 13 | - defaultRatchetWindowSize, | ||
| 14 | - true, | ||
| 15 | -), encryptionType: Encryption.Type = Encryption.Type.GCM) { | 11 | +constructor( |
| 12 | + keyProvider: KeyProvider = BaseKeyProvider( | ||
| 13 | + defaultRatchetSalt, | ||
| 14 | + defaultMagicBytes, | ||
| 15 | + defaultRatchetWindowSize, | ||
| 16 | + true, | ||
| 17 | + defaultFaultTolerance, | ||
| 18 | + ), encryptionType: Encryption.Type = Encryption.Type.GCM | ||
| 19 | +) { | ||
| 16 | var keyProvider: KeyProvider | 20 | var keyProvider: KeyProvider |
| 17 | var encryptionType: Encryption.Type = Encryption.Type.NONE | 21 | var encryptionType: Encryption.Type = Encryption.Type.NONE |
| 22 | + | ||
| 18 | init { | 23 | init { |
| 19 | this.keyProvider = keyProvider | 24 | this.keyProvider = keyProvider |
| 20 | this.encryptionType = encryptionType | 25 | this.encryptionType = encryptionType |
| @@ -23,7 +23,13 @@ constructor(var participantId: String, var keyIndex: Int, var key: String ) { | @@ -23,7 +23,13 @@ constructor(var participantId: String, var keyIndex: Int, var key: String ) { | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | class BaseKeyProvider | 25 | class BaseKeyProvider |
| 26 | -constructor(private var ratchetSalt: String, private var uncryptedMagicBytes: String, private var ratchetWindowSize: Int, override var enableSharedKey: Boolean = true) : | 26 | +constructor( |
| 27 | + private var ratchetSalt: String, | ||
| 28 | + private var uncryptedMagicBytes: String, | ||
| 29 | + private var ratchetWindowSize: Int, | ||
| 30 | + override var enableSharedKey: Boolean = true, | ||
| 31 | + private var failureTolerance:Int, | ||
| 32 | +) : | ||
| 27 | KeyProvider { | 33 | KeyProvider { |
| 28 | override var sharedKey: ByteArray? = null | 34 | override var sharedKey: ByteArray? = null |
| 29 | private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf() | 35 | private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf() |
| @@ -61,15 +67,12 @@ constructor(private var ratchetSalt: String, private var uncryptedMagicBytes: St | @@ -61,15 +67,12 @@ constructor(private var ratchetSalt: String, private var uncryptedMagicBytes: St | ||
| 61 | override val rtcKeyProvider: FrameCryptorKeyProvider | 67 | override val rtcKeyProvider: FrameCryptorKeyProvider |
| 62 | 68 | ||
| 63 | init { | 69 | init { |
| 64 | - this.ratchetSalt = ratchetSalt | ||
| 65 | - this.uncryptedMagicBytes = uncryptedMagicBytes | ||
| 66 | - this.ratchetWindowSize = ratchetWindowSize | ||
| 67 | - this.enableSharedKey = enableSharedKey | ||
| 68 | this.rtcKeyProvider = FrameCryptorFactory.createFrameCryptorKeyProvider( | 70 | this.rtcKeyProvider = FrameCryptorFactory.createFrameCryptorKeyProvider( |
| 69 | enableSharedKey, | 71 | enableSharedKey, |
| 70 | ratchetSalt.toByteArray(), | 72 | ratchetSalt.toByteArray(), |
| 71 | ratchetWindowSize, | 73 | ratchetWindowSize, |
| 72 | uncryptedMagicBytes.toByteArray(), | 74 | uncryptedMagicBytes.toByteArray(), |
| 75 | + failureTolerance | ||
| 73 | ) | 76 | ) |
| 74 | } | 77 | } |
| 75 | } | 78 | } |
| @@ -78,7 +78,6 @@ internal fun RTCConfiguration.copyFrom(config: RTCConfiguration) { | @@ -78,7 +78,6 @@ internal fun RTCConfiguration.copyFrom(config: RTCConfiguration) { | ||
| 78 | stableWritableConnectionPingIntervalMs = config.stableWritableConnectionPingIntervalMs | 78 | stableWritableConnectionPingIntervalMs = config.stableWritableConnectionPingIntervalMs |
| 79 | disableIPv6OnWifi = config.disableIPv6OnWifi | 79 | disableIPv6OnWifi = config.disableIPv6OnWifi |
| 80 | maxIPv6Networks = config.maxIPv6Networks | 80 | maxIPv6Networks = config.maxIPv6Networks |
| 81 | - disableIpv6 = config.disableIpv6 | ||
| 82 | enableDscp = config.enableDscp | 81 | enableDscp = config.enableDscp |
| 83 | enableCpuOveruseDetection = config.enableCpuOveruseDetection | 82 | enableCpuOveruseDetection = config.enableCpuOveruseDetection |
| 84 | suspendBelowMinBitrate = config.suspendBelowMinBitrate | 83 | suspendBelowMinBitrate = config.suspendBelowMinBitrate |
| @@ -178,11 +178,11 @@ suspend fun RTCStatsGetter.getStats(): RTCStatsReport = suspendCancellableCorout | @@ -178,11 +178,11 @@ suspend fun RTCStatsGetter.getStats(): RTCStatsReport = suspendCancellableCorout | ||
| 178 | 178 | ||
| 179 | fun createStatsGetter(peerConnection: PeerConnection, sender: RtpSender): RTCStatsGetter = | 179 | fun createStatsGetter(peerConnection: PeerConnection, sender: RtpSender): RTCStatsGetter = |
| 180 | { statsCallback: RTCStatsCollectorCallback -> | 180 | { statsCallback: RTCStatsCollectorCallback -> |
| 181 | - peerConnection.getStats(statsCallback, sender) | 181 | + peerConnection.getStats(sender, statsCallback) |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | fun createStatsGetter(peerConnection: PeerConnection, receiver: RtpReceiver): RTCStatsGetter = | 184 | fun createStatsGetter(peerConnection: PeerConnection, receiver: RtpReceiver): RTCStatsGetter = |
| 185 | { statsCallback: RTCStatsCollectorCallback -> | 185 | { statsCallback: RTCStatsCollectorCallback -> |
| 186 | - peerConnection.getStats(statsCallback, receiver) | 186 | + peerConnection.getStats(receiver, statsCallback) |
| 187 | } | 187 | } |
| 188 | 188 |
-
请 注册 或 登录 后发表评论