Skip to content

Commit 1a032f5

Browse files
committed
WebRTC Client Rust. Fix issues caused by ktor-client-webrtc changes.
1 parent ca6527e commit 1a032f5

File tree

13 files changed

+747
-2114
lines changed

13 files changed

+747
-2114
lines changed

gradle/artifacts/publishJvmAndCommonPublications.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ io.ktor:ktor-client-serialization/sources.jar
179179
io.ktor:ktor-client-webrtc-android/.aar
180180
io.ktor:ktor-client-webrtc-android/javadoc.jar
181181
io.ktor:ktor-client-webrtc-android/sources.jar
182+
io.ktor:ktor-client-webrtc-jvm/.jar
183+
io.ktor:ktor-client-webrtc-jvm/javadoc.jar
184+
io.ktor:ktor-client-webrtc-jvm/sources.jar
182185
io.ktor:ktor-client-webrtc/.jar
183186
io.ktor:ktor-client-webrtc/javadoc.jar
184187
io.ktor:ktor-client-webrtc/kotlin-tooling-metadata.json

ktor-client/ktor-client-webrtc/api/android/ktor-client-webrtc.api

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,14 +357,16 @@ public final class io/ktor/client/webrtc/WebRtc$IceGatheringState : java/lang/En
357357
public final class io/ktor/client/webrtc/WebRtc$IceServer {
358358
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
359359
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
360-
public final fun component1 ()Ljava/lang/String;
360+
public fun <init> (Ljava/util/List;Ljava/lang/String;Ljava/lang/String;)V
361+
public synthetic fun <init> (Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
362+
public final fun component1 ()Ljava/util/List;
361363
public final fun component2 ()Ljava/lang/String;
362364
public final fun component3 ()Ljava/lang/String;
363-
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lio/ktor/client/webrtc/WebRtc$IceServer;
364-
public static synthetic fun copy$default (Lio/ktor/client/webrtc/WebRtc$IceServer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/ktor/client/webrtc/WebRtc$IceServer;
365+
public final fun copy (Ljava/util/List;Ljava/lang/String;Ljava/lang/String;)Lio/ktor/client/webrtc/WebRtc$IceServer;
366+
public static synthetic fun copy$default (Lio/ktor/client/webrtc/WebRtc$IceServer;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/ktor/client/webrtc/WebRtc$IceServer;
365367
public fun equals (Ljava/lang/Object;)Z
366368
public final fun getCredential ()Ljava/lang/String;
367-
public final fun getUrls ()Ljava/lang/String;
369+
public final fun getUrls ()Ljava/util/List;
368370
public final fun getUsername ()Ljava/lang/String;
369371
public fun hashCode ()I
370372
public fun toString ()Ljava/lang/String;
@@ -788,6 +790,7 @@ public abstract class io/ktor/client/webrtc/WebRtcPeerConnection : io/ktor/clien
788790
public abstract fun removeTrack (Lio/ktor/client/webrtc/WebRtc$RtpSender;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
789791
public abstract fun removeTrack (Lio/ktor/client/webrtc/WebRtcMedia$Track;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
790792
public abstract fun restartIce ()V
793+
protected final fun runInConnectionScope (Lkotlin/jvm/functions/Function0;)V
791794
public abstract fun setLocalDescription (Lio/ktor/client/webrtc/WebRtc$SessionDescription;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
792795
public abstract fun setRemoteDescription (Lio/ktor/client/webrtc/WebRtc$SessionDescription;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
793796
}

ktor-client/ktor-client-webrtc/api/jvm/ktor-client-webrtc.api

Lines changed: 692 additions & 0 deletions
Large diffs are not rendered by default.

ktor-client/ktor-client-webrtc/api/ktor-client-webrtc.klib.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ abstract class io.ktor.client.webrtc/WebRtcPeerConnection : io.ktor.client.webrt
172172
abstract suspend fun removeTrack(io.ktor.client.webrtc/WebRtcMedia.Track) // io.ktor.client.webrtc/WebRtcPeerConnection.removeTrack|removeTrack(io.ktor.client.webrtc.WebRtcMedia.Track){}[0]
173173
abstract suspend fun setLocalDescription(io.ktor.client.webrtc/WebRtc.SessionDescription) // io.ktor.client.webrtc/WebRtcPeerConnection.setLocalDescription|setLocalDescription(io.ktor.client.webrtc.WebRtc.SessionDescription){}[0]
174174
abstract suspend fun setRemoteDescription(io.ktor.client.webrtc/WebRtc.SessionDescription) // io.ktor.client.webrtc/WebRtcPeerConnection.setRemoteDescription|setRemoteDescription(io.ktor.client.webrtc.WebRtc.SessionDescription){}[0]
175+
final inline fun runInConnectionScope(crossinline kotlin/Function0<kotlin/Unit>) // io.ktor.client.webrtc/WebRtcPeerConnection.runInConnectionScope|runInConnectionScope(kotlin.Function0<kotlin.Unit>){}[0]
175176
final suspend fun awaitIceGatheringComplete() // io.ktor.client.webrtc/WebRtcPeerConnection.awaitIceGatheringComplete|awaitIceGatheringComplete(){}[0]
176177
open fun close() // io.ktor.client.webrtc/WebRtcPeerConnection.close|close(){}[0]
177178
}
@@ -595,6 +596,7 @@ final object io.ktor.client.webrtc/WebRtc { // io.ktor.client.webrtc/WebRtc|null
595596

596597
final class IceServer { // io.ktor.client.webrtc/WebRtc.IceServer|null[0]
597598
constructor <init>(kotlin.collections/List<kotlin/String>, kotlin/String? = ..., kotlin/String? = ...) // io.ktor.client.webrtc/WebRtc.IceServer.<init>|<init>(kotlin.collections.List<kotlin.String>;kotlin.String?;kotlin.String?){}[0]
599+
constructor <init>(kotlin/String, kotlin/String? = ..., kotlin/String? = ...) // io.ktor.client.webrtc/WebRtc.IceServer.<init>|<init>(kotlin.String;kotlin.String?;kotlin.String?){}[0]
598600

599601
final val credential // io.ktor.client.webrtc/WebRtc.IceServer.credential|{}credential[0]
600602
final fun <get-credential>(): kotlin/String? // io.ktor.client.webrtc/WebRtc.IceServer.credential.<get-credential>|<get-credential>(){}[0]

ktor-client/ktor-client-webrtc/common/src/io/ktor/client/webrtc/WebRtc.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ public object WebRtc {
9999
val urls: List<String>,
100100
val username: String? = null,
101101
val credential: String? = null
102-
)
102+
) {
103+
public constructor(url: String, username: String? = null, credential: String? = null) : this(
104+
urls = listOf(url),
105+
username,
106+
credential
107+
)
108+
}
103109

104110
/**
105111
* Represents the bundle policy for media negotiation.

ktor-client/ktor-client-webrtc/common/src/io/ktor/client/webrtc/WebRtcPeerConnection.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public abstract class WebRtcPeerConnection private constructor(
130130
* Runs a [block] in the coroutine scope of the peer connection without extra dispatching.
131131
* This should be used to run some background tasks without losing thrown exceptions.
132132
*/
133-
internal inline fun runInConnectionScope(crossinline block: () -> Unit) {
133+
protected inline fun runInConnectionScope(crossinline block: () -> Unit) {
134134
coroutineScope.launch(start = CoroutineStart.UNDISPATCHED) { block() }
135135
}
136136

ktor-client/ktor-client-webrtc/gradle.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ target.android.unitTest=false
77
target.androidNative=true
88
target.desktop=false
99
target.darwin=false
10-
target.jvm=false
10+
# jvm "dummy" srcset is needed for `ktor-client-webrtc-rs`
11+
target.jvm=true
1112
target.ios=true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2014-2026 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package io.ktor.client.webrtc.utils
6+
7+
import io.ktor.client.webrtc.WebRtcClient
8+
import io.ktor.utils.io.ExperimentalKtorApi
9+
10+
@OptIn(markerClass = [ExperimentalKtorApi::class])
11+
actual fun createTestWebRtcClient(): WebRtcClient {
12+
TODO("Not yet implemented")
13+
}
14+
15+
actual fun grantPermissions(audio: Boolean, video: Boolean) {
16+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/*
2+
* Copyright 2014-2026 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package io.ktor.client.webrtc.utils
6+
7+
actual typealias IgnoreJvm = org.junit.jupiter.api.Disabled
8+
9+
@Target(allowedTargets = [AnnotationTarget.CLASS, AnnotationTarget.FUNCTION])
10+
actual annotation class IgnoreDesktop actual constructor()

0 commit comments

Comments
 (0)