davidliu
Committed by GitHub

Update webrtc to 114.5735.03 (#267)

* update libwebrtc to 114.5735.02

* update to 114.5735.03
... ... @@ -135,10 +135,11 @@ dokkaHtml {
}
dependencies {
//api fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation deps.coroutines.lib
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0'
api 'io.github.webrtc-sdk:android:104.5112.10'
api 'io.github.webrtc-sdk:android:114.5735.03'
api "com.squareup.okhttp3:okhttp:4.10.0"
api 'com.github.davidliu:audioswitch:d18e3e31d427c27f1593030e024b370bf24480fd'
implementation "androidx.annotation:annotation:1.4.0"
... ...
... ... @@ -26,6 +26,9 @@ import javax.inject.Named
import javax.inject.Provider
import javax.inject.Singleton
/**
* @suppress
*/
@Module
object AudioHandlerModule {
... ...
... ... @@ -21,6 +21,9 @@ import dagger.Provides
import kotlinx.coroutines.Dispatchers
import javax.inject.Named
/**
* @suppress
*/
@Module
object CoroutinesModule {
@Provides
... ...
... ... @@ -16,6 +16,9 @@
package io.livekit.android.dagger
/**
* @suppress
*/
object InjectionNames {
/**
... ... @@ -42,6 +45,8 @@ object InjectionNames {
internal const val OPTIONS_VIDEO_HW_ACCEL = "options_video_hw_accel"
internal const val LIB_WEBRTC_INITIALIZATION = "lib_webrtc_initialization"
// Overrides
internal const val OVERRIDE_OKHTTP = "override_okhttp"
internal const val OVERRIDE_AUDIO_DEVICE_MODULE = "override_audio_device_module"
... ...
... ... @@ -21,6 +21,9 @@ import dagger.Provides
import dagger.Reusable
import kotlinx.serialization.json.Json
/**
* @suppress
*/
@Module
object JsonFormatModule {
@Provides
... ...
... ... @@ -21,6 +21,9 @@ import dagger.Provides
import io.livekit.android.memory.CloseableManager
import javax.inject.Singleton
/**
* @suppress
*/
@Module
object MemoryModule {
... ...
... ... @@ -24,6 +24,9 @@ import io.livekit.android.LiveKitOverrides
import javax.inject.Named
@SuppressLint("KotlinNullnessAnnotation")
/**
* @suppress
*/
@Module
class OverridesModule(private val overrides: LiveKitOverrides) {
... ...
... ... @@ -37,8 +37,44 @@ import javax.inject.Singleton
typealias CapabilitiesGetter = @JvmSuppressWildcards (MediaStreamTrack.MediaType) -> RtpCapabilities
/**
* @suppress
*/
@Module
object RTCModule {
/**
* Certain classes require libwebrtc to be initialized prior to use.
*/
@Provides
@Singleton
@Named(InjectionNames.LIB_WEBRTC_INITIALIZATION)
fun libWebrtcInitialization(appContext: Context): LibWebrtcInitialization {
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions
.builder(appContext)
.setInjectableLogger({ s, severity, s2 ->
if (!LiveKit.enableWebRTCLogging) {
return@setInjectableLogger
}
val loggingLevel = when (severity) {
Logging.Severity.LS_VERBOSE -> LoggingLevel.VERBOSE
Logging.Severity.LS_INFO -> LoggingLevel.INFO
Logging.Severity.LS_WARNING -> LoggingLevel.WARN
Logging.Severity.LS_ERROR -> LoggingLevel.ERROR
else -> LoggingLevel.OFF
}
LKLog.log(loggingLevel) {
Timber.log(loggingLevel.toAndroidLogPriority(), "$s2: $s")
}
}, Logging.Severity.LS_VERBOSE)
.createInitializationOptions()
)
return LibWebrtcInitialization
}
@Provides
@Singleton
@JvmSuppressWildcards
... ... @@ -144,6 +180,9 @@ object RTCModule {
@Provides
fun videoEncoderFactory(
@Suppress("UNUSED_PARAMETER")
@Named(InjectionNames.LIB_WEBRTC_INITIALIZATION)
webrtcInitialization: LibWebrtcInitialization,
@Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL)
videoHwAccel: Boolean,
eglContext: EglBase.Context,
... ... @@ -164,6 +203,9 @@ object RTCModule {
@Provides
fun videoDecoderFactory(
@Suppress("UNUSED_PARAMETER")
@Named(InjectionNames.LIB_WEBRTC_INITIALIZATION)
webrtcInitialization: LibWebrtcInitialization,
@Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL)
videoHwAccel: Boolean,
eglContext: EglBase.Context,
... ... @@ -181,33 +223,13 @@ object RTCModule {
@Provides
@Singleton
fun peerConnectionFactory(
appContext: Context,
@Suppress("UNUSED_PARAMETER")
@Named(InjectionNames.LIB_WEBRTC_INITIALIZATION)
webrtcInitialization: LibWebrtcInitialization,
audioDeviceModule: AudioDeviceModule,
videoEncoderFactory: VideoEncoderFactory,
videoDecoderFactory: VideoDecoderFactory,
): PeerConnectionFactory {
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions
.builder(appContext)
.setInjectableLogger({ s, severity, s2 ->
if (!LiveKit.enableWebRTCLogging) {
return@setInjectableLogger
}
val loggingLevel = when (severity) {
Logging.Severity.LS_VERBOSE -> LoggingLevel.VERBOSE
Logging.Severity.LS_INFO -> LoggingLevel.INFO
Logging.Severity.LS_WARNING -> LoggingLevel.WARN
Logging.Severity.LS_ERROR -> LoggingLevel.ERROR
else -> LoggingLevel.OFF
}
LKLog.log(loggingLevel) {
Timber.log(loggingLevel.toAndroidLogPriority(), "$s2: $s")
}
}, Logging.Severity.LS_VERBOSE)
.createInitializationOptions()
)
return PeerConnectionFactory.builder()
.setAudioDeviceModule(audioDeviceModule)
.setVideoEncoderFactory(videoEncoderFactory)
... ... @@ -226,4 +248,9 @@ object RTCModule {
@Provides
@Named(InjectionNames.OPTIONS_VIDEO_HW_ACCEL)
fun videoHwAccel() = true
}
\ No newline at end of file
}
/**
* @suppress
*/
object LibWebrtcInitialization
\ No newline at end of file
... ...
... ... @@ -29,6 +29,9 @@ import java.util.concurrent.TimeUnit
import javax.inject.Named
import javax.inject.Singleton
/**
* @suppress
*/
@Module
object WebModule {
@Provides
... ...
... ... @@ -5,16 +5,21 @@ import livekit.LivekitModels.Encryption
var defaultRatchetSalt = "LKFrameEncryptionKey"
var defaultMagicBytes = "LK-ROCKS"
var defaultRatchetWindowSize = 16
var defaultFaultTolerance = -1
class E2EEOptions
constructor(keyProvider: KeyProvider = BaseKeyProvider(
defaultRatchetSalt,
defaultMagicBytes,
defaultRatchetWindowSize,
true,
), encryptionType: Encryption.Type = Encryption.Type.GCM) {
constructor(
keyProvider: KeyProvider = BaseKeyProvider(
defaultRatchetSalt,
defaultMagicBytes,
defaultRatchetWindowSize,
true,
defaultFaultTolerance,
), encryptionType: Encryption.Type = Encryption.Type.GCM
) {
var keyProvider: KeyProvider
var encryptionType: Encryption.Type = Encryption.Type.NONE
init {
this.keyProvider = keyProvider
this.encryptionType = encryptionType
... ...
... ... @@ -23,7 +23,13 @@ constructor(var participantId: String, var keyIndex: Int, var key: String ) {
}
class BaseKeyProvider
constructor(private var ratchetSalt: String, private var uncryptedMagicBytes: String, private var ratchetWindowSize: Int, override var enableSharedKey: Boolean = true) :
constructor(
private var ratchetSalt: String,
private var uncryptedMagicBytes: String,
private var ratchetWindowSize: Int,
override var enableSharedKey: Boolean = true,
private var failureTolerance:Int,
) :
KeyProvider {
override var sharedKey: ByteArray? = null
private var keys: MutableMap<String, MutableMap<Int, String>> = mutableMapOf()
... ... @@ -61,15 +67,12 @@ constructor(private var ratchetSalt: String, private var uncryptedMagicBytes: St
override val rtcKeyProvider: FrameCryptorKeyProvider
init {
this.ratchetSalt = ratchetSalt
this.uncryptedMagicBytes = uncryptedMagicBytes
this.ratchetWindowSize = ratchetWindowSize
this.enableSharedKey = enableSharedKey
this.rtcKeyProvider = FrameCryptorFactory.createFrameCryptorKeyProvider(
enableSharedKey,
ratchetSalt.toByteArray(),
ratchetWindowSize,
uncryptedMagicBytes.toByteArray(),
failureTolerance
)
}
}
... ...
... ... @@ -78,7 +78,6 @@ internal fun RTCConfiguration.copyFrom(config: RTCConfiguration) {
stableWritableConnectionPingIntervalMs = config.stableWritableConnectionPingIntervalMs
disableIPv6OnWifi = config.disableIPv6OnWifi
maxIPv6Networks = config.maxIPv6Networks
disableIpv6 = config.disableIpv6
enableDscp = config.enableDscp
enableCpuOveruseDetection = config.enableCpuOveruseDetection
suspendBelowMinBitrate = config.suspendBelowMinBitrate
... ...
... ... @@ -178,11 +178,11 @@ suspend fun RTCStatsGetter.getStats(): RTCStatsReport = suspendCancellableCorout
fun createStatsGetter(peerConnection: PeerConnection, sender: RtpSender): RTCStatsGetter =
{ statsCallback: RTCStatsCollectorCallback ->
peerConnection.getStats(statsCallback, sender)
peerConnection.getStats(sender, statsCallback)
}
fun createStatsGetter(peerConnection: PeerConnection, receiver: RtpReceiver): RTCStatsGetter =
{ statsCallback: RTCStatsCollectorCallback ->
peerConnection.getStats(statsCallback, receiver)
peerConnection.getStats(receiver, statsCallback)
}
... ...