Skip to content

Commit

Permalink
Update to m125 (#436)
Browse files Browse the repository at this point in the history
* Fix compile errors with m125

* Update default encryption option values

* Update webrtc to m125.6422.02

* spotless
  • Loading branch information
davidliu authored Jun 16, 2024
1 parent d3f8580 commit 67d6912
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
webrtc = "114.5735.09"
webrtc = "125.6422.02"

androidJainSipRi = "1.3.0-91"
androidx-activity = "1.9.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023 LiveKit, Inc.
* Copyright 2023-2024 LiveKit, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,10 +18,12 @@ package io.livekit.android.e2ee

import livekit.LivekitModels.Encryption

var defaultRatchetSalt = "LKFrameEncryptionKey"
var defaultMagicBytes = "LK-ROCKS"
var defaultRatchetWindowSize = 0
var defaultFaultTolerance = -1
internal const val defaultRatchetSalt = "LKFrameEncryptionKey"
internal const val defaultMagicBytes = "LK-ROCKS"
internal const val defaultRatchetWindowSize = 16
internal const val defaultFailureTolerance = -1
internal const val defaultKeyRingSize = 16
internal const val defaultDiscardFrameWhenCryptorNotReady = false

class E2EEOptions
constructor(
Expand All @@ -30,7 +32,9 @@ constructor(
defaultMagicBytes,
defaultRatchetWindowSize,
true,
defaultFaultTolerance,
defaultFailureTolerance,
defaultKeyRingSize,
defaultDiscardFrameWhenCryptorNotReady,
),
encryptionType: Encryption.Type = Encryption.Type.GCM,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ public interface KeyProvider {

class BaseKeyProvider
constructor(
private var ratchetSalt: String,
private var uncryptedMagicBytes: String,
private var ratchetWindowSize: Int,
private var ratchetSalt: String = defaultRatchetSalt,
private var uncryptedMagicBytes: String = defaultMagicBytes,
private var ratchetWindowSize: Int = defaultRatchetWindowSize,
override var enableSharedKey: Boolean = true,
private var failureTolerance: Int,
) :
KeyProvider {
private var failureTolerance: Int = defaultFailureTolerance,
private var keyRingSize: Int = defaultKeyRingSize,
private var discardFrameWhenCryptorNotReady: Boolean = defaultDiscardFrameWhenCryptorNotReady,
) : KeyProvider {
private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf()
override fun setSharedKey(key: String, keyIndex: Int?): Boolean {
return rtcKeyProvider.setSharedKey(keyIndex ?: 0, key.toByteArray())
Expand Down Expand Up @@ -109,6 +110,8 @@ constructor(
ratchetWindowSize,
uncryptedMagicBytes.toByteArray(),
failureTolerance,
keyRingSize,
discardFrameWhenCryptorNotReady,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,10 @@ fun RTCConfiguration.copyFrom(config: RTCConfiguration) {
enableCpuOveruseDetection = config.enableCpuOveruseDetection
suspendBelowMinBitrate = config.suspendBelowMinBitrate
screencastMinBitrate = config.screencastMinBitrate
combinedAudioVideoBwe = config.combinedAudioVideoBwe
networkPreference = config.networkPreference
sdpSemantics = config.sdpSemantics
turnCustomizer = config.turnCustomizer
activeResetSrtpParams = config.activeResetSrtpParams
allowCodecSwitching = config.allowCodecSwitching
cryptoOptions = config.cryptoOptions
turnLoggingId = config.turnLoggingId
enableImplicitRollback = config.enableImplicitRollback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,17 @@
package io.livekit.android.webrtc

import io.livekit.android.util.LKLog
import livekit.org.webrtc.*
import livekit.org.webrtc.EglBase
import livekit.org.webrtc.HardwareVideoEncoderFactory
import livekit.org.webrtc.SimulcastVideoEncoderFactory
import livekit.org.webrtc.SoftwareVideoEncoderFactory
import livekit.org.webrtc.VideoCodecInfo
import livekit.org.webrtc.VideoCodecStatus
import livekit.org.webrtc.VideoEncoder
import livekit.org.webrtc.VideoEncoderFactory
import livekit.org.webrtc.VideoEncoderFallback
import livekit.org.webrtc.VideoFrame
import livekit.org.webrtc.WrappedNativeVideoEncoder
import java.util.concurrent.Callable
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
Expand Down Expand Up @@ -194,8 +204,8 @@ open class SimulcastVideoEncoderFactoryWrapper(
return future.get()
}

override fun createNativeVideoEncoder(): Long {
val future = executor.submit(Callable { return@Callable encoder.createNativeVideoEncoder() })
override fun createNative(webrtcEnvRef: Long): Long {
val future = executor.submit(Callable { return@Callable encoder.createNative(webrtcEnvRef) })
return future.get()
}

Expand Down
1 change: 0 additions & 1 deletion livekit-android-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ dependencies {
implementation libs.timber
implementation libs.coroutines.lib
implementation libs.kotlinx.serialization.json
api libs.webrtc
api libs.okhttp
api libs.audioswitch
implementation libs.androidx.annotation
Expand Down

0 comments on commit 67d6912

Please sign in to comment.