diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/MainActivity.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/MainActivity.kt index 72b7a4f8..7fbcc819 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/MainActivity.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/MainActivity.kt @@ -45,7 +45,7 @@ class MainActivity : ComponentActivity() { WebRtcSessionManagerImpl( context = this, signalingClient = SignalingClient(), - peerConnectionFactory = StreamPeerConnectionFactory(this) + peerConnectionFactory = StreamPeerConnectionFactory(this), ) } @@ -60,7 +60,7 @@ class MainActivity : ComponentActivity() { // A surface container using the 'background' color from the theme Surface( modifier = Modifier.fillMaxSize(), - color = MaterialTheme.colors.background + color = MaterialTheme.colors.background, ) { var onCallScreen by remember { mutableStateOf(BuildConfig.BUILD_TYPE == "benchmark") } val state by sessionManager.signalingClient.sessionStateFlow.collectAsState() diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/components/VideoRenderer.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/components/VideoRenderer.kt index f652e062..e0406f83 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/components/VideoRenderer.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/components/VideoRenderer.kt @@ -39,7 +39,7 @@ import org.webrtc.VideoTrack @Composable fun VideoRendererasd( videoTrack: VideoTrack, - modifier: Modifier = Modifier + modifier: Modifier = Modifier, ) { val trackState: MutableState = remember { mutableStateOf(null) } var view: VideoTextureViewRenderer? by remember { mutableStateOf(null) } @@ -60,20 +60,20 @@ fun VideoRendererasd( override fun onFirstFrameRendered() = Unit override fun onFrameResolutionChanged(p0: Int, p1: Int, p2: Int) = Unit - } + }, ) setupVideo(trackState, videoTrack, this) view = this } }, update = { v -> setupVideo(trackState, videoTrack, v) }, - modifier = modifier + modifier = modifier, ) } private fun cleanTrack( view: VideoTextureViewRenderer?, - trackState: MutableState + trackState: MutableState, ) { view?.let { trackState.value?.removeSink(it) } trackState.value = null @@ -82,7 +82,7 @@ private fun cleanTrack( private fun setupVideo( trackState: MutableState, track: VideoTrack, - renderer: VideoTextureViewRenderer + renderer: VideoTextureViewRenderer, ) { if (trackState.value == track) { return diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/stage/StageScreen.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/stage/StageScreen.kt index 2440d807..aedc41e1 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/stage/StageScreen.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/stage/StageScreen.kt @@ -36,7 +36,7 @@ import io.getstream.webrtc.sample.compose.webrtc.WebRTCSessionState @Composable fun StageScreen( state: WebRTCSessionState, - onJoinCall: () -> Unit + onJoinCall: () -> Unit, ) { Box(modifier = Modifier.fillMaxSize()) { var enabledCall by remember { mutableStateOf(false) } @@ -67,12 +67,12 @@ fun StageScreen( Button( modifier = Modifier.align(Alignment.Center), enabled = enabledCall, - onClick = { onJoinCall.invoke() } + onClick = { onJoinCall.invoke() }, ) { Text( text = text, fontSize = 26.sp, - fontWeight = FontWeight.Bold + fontWeight = FontWeight.Bold, ) } } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/CallMediaState.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/CallMediaState.kt index 97e05841..bba0bd1d 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/CallMediaState.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/CallMediaState.kt @@ -18,5 +18,5 @@ package io.getstream.webrtc.sample.compose.ui.screens.video data class CallMediaState( val isMicrophoneEnabled: Boolean = true, - val isCameraEnabled: Boolean = true + val isCameraEnabled: Boolean = true, ) diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControlAction.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControlAction.kt index 90394485..b05c0747 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControlAction.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControlAction.kt @@ -26,11 +26,11 @@ import io.getstream.webrtc.sample.compose.ui.theme.Primary sealed class CallAction { data class ToggleMicroPhone( - val isEnabled: Boolean + val isEnabled: Boolean, ) : CallAction() data class ToggleCamera( - val isEnabled: Boolean + val isEnabled: Boolean, ) : CallAction() object FlipCamera : CallAction() @@ -42,12 +42,12 @@ data class VideoCallControlAction( val icon: Painter, val iconTint: Color, val background: Color, - val callAction: CallAction + val callAction: CallAction, ) @Composable fun buildDefaultCallControlActions( - callMediaState: CallMediaState + callMediaState: CallMediaState, ): List { val microphoneIcon = painterResource( @@ -55,7 +55,7 @@ fun buildDefaultCallControlActions( R.drawable.ic_mic_on } else { R.drawable.ic_mic_off - } + }, ) val cameraIcon = painterResource( @@ -63,7 +63,7 @@ fun buildDefaultCallControlActions( R.drawable.ic_videocam_on } else { R.drawable.ic_videocam_off - } + }, ) return listOf( @@ -71,25 +71,25 @@ fun buildDefaultCallControlActions( icon = microphoneIcon, iconTint = Color.White, background = Primary, - callAction = CallAction.ToggleMicroPhone(callMediaState.isMicrophoneEnabled) + callAction = CallAction.ToggleMicroPhone(callMediaState.isMicrophoneEnabled), ), VideoCallControlAction( icon = cameraIcon, iconTint = Color.White, background = Primary, - callAction = CallAction.ToggleCamera(callMediaState.isCameraEnabled) + callAction = CallAction.ToggleCamera(callMediaState.isCameraEnabled), ), VideoCallControlAction( icon = painterResource(id = R.drawable.ic_camera_flip), iconTint = Color.White, background = Primary, - callAction = CallAction.FlipCamera + callAction = CallAction.FlipCamera, ), VideoCallControlAction( icon = painterResource(id = R.drawable.ic_call_end), iconTint = Color.White, background = Disabled, - callAction = CallAction.LeaveCall - ) + callAction = CallAction.LeaveCall, + ), ) } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControls.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControls.kt index bce6d24d..39d5db25 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControls.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallControls.kt @@ -36,20 +36,21 @@ import androidx.compose.ui.unit.dp fun VideoCallControls( modifier: Modifier, callMediaState: CallMediaState, - actions: List = buildDefaultCallControlActions(callMediaState = callMediaState), - onCallAction: (CallAction) -> Unit + actions: List = + buildDefaultCallControlActions(callMediaState = callMediaState), + onCallAction: (CallAction) -> Unit, ) { LazyRow( modifier = modifier.padding(bottom = 12.dp), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceEvenly + horizontalArrangement = Arrangement.SpaceEvenly, ) { items(actions) { action -> Box( modifier = Modifier .size(56.dp) .clip(CircleShape) - .background(action.background) + .background(action.background), ) { Icon( modifier = Modifier @@ -58,7 +59,7 @@ fun VideoCallControls( .clickable { onCallAction(action.callAction) }, tint = action.iconTint, painter = action.icon, - contentDescription = null + contentDescription = null, ) } } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallScreen.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallScreen.kt index 8cbba258..43aa514a 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallScreen.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/screens/video/VideoCallScreen.kt @@ -51,7 +51,7 @@ fun VideoCallScreen() { } Box( - modifier = Modifier.fillMaxSize() + modifier = Modifier.fillMaxSize(), ) { var parentSize: IntSize by remember { mutableStateOf(IntSize(0, 0)) } @@ -74,7 +74,7 @@ fun VideoCallScreen() { .fillMaxSize() .onSizeChanged { parentSize = it }, eglBaseContext = sessionManager.peerConnectionFactory.eglBaseContext, - rendererEvents = rendererEvents + rendererEvents = rendererEvents, ) } @@ -88,7 +88,7 @@ fun VideoCallScreen() { parentBounds = parentSize, paddingValues = PaddingValues(0.dp), eglBaseContext = sessionManager.peerConnectionFactory.eglBaseContext, - rendererEvents = rendererEvents + rendererEvents = rendererEvents, ) } @@ -117,7 +117,7 @@ fun VideoCallScreen() { activity?.finish() } } - } + }, ) } } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Shape.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Shape.kt index 9a031450..78cbb7e6 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Shape.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Shape.kt @@ -23,5 +23,5 @@ import androidx.compose.ui.unit.dp val Shapes = Shapes( small = RoundedCornerShape(4.dp), medium = RoundedCornerShape(4.dp), - large = RoundedCornerShape(0.dp) + large = RoundedCornerShape(0.dp), ) diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Theme.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Theme.kt index e65a88c2..a9918496 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Theme.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Theme.kt @@ -25,13 +25,13 @@ import androidx.compose.runtime.Composable private val DarkColorPalette = darkColors( primary = Purple200, primaryVariant = Purple700, - secondary = Teal200 + secondary = Teal200, ) private val LightColorPalette = lightColors( primary = Purple500, primaryVariant = Purple700, - secondary = Teal200 + secondary = Teal200, /* Other default colors to override background = Color.White, @@ -46,7 +46,7 @@ private val LightColorPalette = lightColors( @Composable fun WebrtcSampleComposeTheme( darkTheme: Boolean = isSystemInDarkTheme(), - content: @Composable () -> Unit + content: @Composable () -> Unit, ) { val colors = if (darkTheme) { DarkColorPalette @@ -58,6 +58,6 @@ fun WebrtcSampleComposeTheme( colors = colors, typography = Typography, shapes = Shapes, - content = content + content = content, ) } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Type.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Type.kt index cf9dde07..37c4e45e 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Type.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/ui/theme/Type.kt @@ -27,8 +27,8 @@ val Typography = Typography( body1 = TextStyle( fontFamily = FontFamily.Default, fontWeight = FontWeight.Normal, - fontSize = 16.sp - ) + fontSize = 16.sp, + ), /* Other default text styles to override button = TextStyle( fontFamily = FontFamily.Default, diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/SignalingClient.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/SignalingClient.kt index 7d12cc51..1f88e7a5 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/SignalingClient.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/SignalingClient.kt @@ -99,12 +99,12 @@ enum class WebRTCSessionState { Creating, // Creating session, offer has been sent Ready, // Both clients available and ready to initiate session Impossible, // We have less than two clients connected to the server - Offline // unable to connect signaling server + Offline, // unable to connect signaling server } enum class SignalingCommand { STATE, // Command for WebRTCSessionState OFFER, // to send or receive offer ANSWER, // to send or receive answer - ICE // to send and receive ice candidates + ICE, // to send and receive ice candidates } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioDeviceChangeListener.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioDeviceChangeListener.kt index 4d4bd9ce..7a6487f9 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioDeviceChangeListener.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioDeviceChangeListener.kt @@ -18,5 +18,5 @@ package io.getstream.webrtc.sample.compose.webrtc.audio typealias AudioDeviceChangeListener = ( audioDevices: List, - selectedAudioDevice: AudioDevice? + selectedAudioDevice: AudioDevice?, ) -> Unit diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioFocusRequestWrapper.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioFocusRequestWrapper.kt index f6f1aa76..695af0e3 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioFocusRequestWrapper.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioFocusRequestWrapper.kt @@ -24,7 +24,9 @@ import android.media.AudioManager internal class AudioFocusRequestWrapper { @SuppressLint("NewApi") - fun buildRequest(audioFocusChangeListener: AudioManager.OnAudioFocusChangeListener): AudioFocusRequest { + fun buildRequest( + audioFocusChangeListener: AudioManager.OnAudioFocusChangeListener, + ): AudioFocusRequest { val playbackAttributes = AudioAttributes.Builder() .setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION) .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH) diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioHandler.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioHandler.kt index 63221302..3f6cf85b 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioHandler.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioHandler.kt @@ -57,7 +57,7 @@ class AudioSwitchHandler constructor(private val context: Context) : AudioHandle context = context, audioFocusChangeListener = onAudioFocusChangeListener ?: defaultOnAudioFocusChangeListener, - preferredDeviceList = preferredDeviceList ?: defaultPreferredDeviceList + preferredDeviceList = preferredDeviceList ?: defaultPreferredDeviceList, ) audioSwitch = switch switch.start(audioDeviceChangeListener ?: defaultAudioDeviceChangeListener) @@ -84,7 +84,7 @@ class AudioSwitchHandler constructor(private val context: Context) : AudioHandle object : AudioDeviceChangeListener { override fun invoke( audioDevices: List, - selectedAudioDevice: AudioDevice? + selectedAudioDevice: AudioDevice?, ) { StreamLog.i(TAG) { "[onAudioDeviceChange] selectedAudioDevice: $selectedAudioDevice" } } @@ -95,7 +95,7 @@ class AudioSwitchHandler constructor(private val context: Context) : AudioHandle AudioDevice.BluetoothHeadset::class.java, AudioDevice.WiredHeadset::class.java, AudioDevice.Earpiece::class.java, - AudioDevice.Speakerphone::class.java + AudioDevice.Speakerphone::class.java, ) } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioManagerAdapterImpl.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioManagerAdapterImpl.kt index 8c6621b8..b3444f1a 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioManagerAdapterImpl.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioManagerAdapterImpl.kt @@ -29,7 +29,7 @@ internal class AudioManagerAdapterImpl( private val context: Context, private val audioManager: AudioManager, private val audioFocusRequest: AudioFocusRequestWrapper = AudioFocusRequestWrapper(), - private val audioFocusChangeListener: AudioManager.OnAudioFocusChangeListener + private val audioFocusChangeListener: AudioManager.OnAudioFocusChangeListener, ) : AudioManagerAdapter { private val logger by taggedLogger("Call:AudioManager") @@ -69,15 +69,21 @@ internal class AudioManagerAdapterImpl( audioRequest = audioFocusRequest.buildRequest(audioFocusChangeListener) audioRequest?.let { val result = audioManager.requestAudioFocus(it) - logger.i { "[setAudioFocus] #new; completed: ${result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED}" } + logger.i { + "[setAudioFocus] #new; completed: " + + "${result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED}" + } } } else { val result = audioManager.requestAudioFocus( audioFocusChangeListener, AudioManager.STREAM_VOICE_CALL, - AudioManager.AUDIOFOCUS_GAIN_TRANSIENT + AudioManager.AUDIOFOCUS_GAIN_TRANSIENT, ) - logger.i { "[setAudioFocus] #old; completed: ${result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED}" } + logger.i { + "[setAudioFocus] #old; completed: " + + "${result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED}" + } } /* * Start by setting MODE_IN_COMMUNICATION as default audio mode. It is diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioSwitch.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioSwitch.kt index b2fb0ade..51dc7c52 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioSwitch.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/audio/AudioSwitch.kt @@ -34,8 +34,8 @@ class AudioSwitch internal constructor( private val audioManager: AudioManagerAdapter = AudioManagerAdapterImpl( context, context.getSystemService(Context.AUDIO_SERVICE) as AudioManager, - audioFocusChangeListener = audioFocusChangeListener - ) + audioFocusChangeListener = audioFocusChangeListener, + ), ) { private val logger by taggedLogger("Call:AudioSwitch") @@ -86,6 +86,7 @@ class AudioSwitch internal constructor( enumerateDevices() state = STARTED } + else -> { } } @@ -103,9 +104,11 @@ class AudioSwitch internal constructor( deactivate() closeListeners() } + STARTED -> { closeListeners() } + STOPPED -> { } } @@ -129,6 +132,7 @@ class AudioSwitch internal constructor( selectedDevice?.let { activate(it) } state = ACTIVATED } + ACTIVATED -> selectedDevice?.let { activate(it) } STOPPED -> throw IllegalStateException() } @@ -146,6 +150,7 @@ class AudioSwitch internal constructor( audioManager.restoreAudioState() state = STARTED } + STARTED, STOPPED -> { } } @@ -179,7 +184,7 @@ class AudioSwitch internal constructor( internal data class AudioDeviceState( val audioDeviceList: List, - val selectedAudioDevice: AudioDevice? + val selectedAudioDevice: AudioDevice?, ) private fun enumerateDevices(bluetoothHeadsetName: String? = null) { @@ -231,14 +236,17 @@ class AudioSwitch internal constructor( * function. */ } + WiredHeadset::class.java -> { logger.v { - "[addAvailableAudioDevices] #WiredHeadset; wiredHeadsetAvailable: $wiredHeadsetAvailable" + "[addAvailableAudioDevices] #WiredHeadset; " + + "wiredHeadsetAvailable: $wiredHeadsetAvailable" } if (wiredHeadsetAvailable) { mutableAudioDevices.add(WiredHeadset()) } } + Earpiece::class.java -> { val hasEarpiece = audioManager.hasEarpiece() logger.v { @@ -249,6 +257,7 @@ class AudioSwitch internal constructor( mutableAudioDevices.add(Earpiece()) } } + Speakerphone::class.java -> { val hasSpeakerphone = audioManager.hasSpeakerphone() logger.v { "[addAvailableAudioDevices] #Speakerphone; hasSpeakerphone: $hasSpeakerphone" } @@ -284,7 +293,7 @@ class AudioSwitch internal constructor( BluetoothHeadset::class.java, WiredHeadset::class.java, Earpiece::class.java, - Speakerphone::class.java + Speakerphone::class.java, ) } } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnection.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnection.kt index eb186145..027408b0 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnection.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnection.kt @@ -61,7 +61,7 @@ class StreamPeerConnection( private val onStreamAdded: ((MediaStream) -> Unit)?, private val onNegotiationNeeded: ((StreamPeerConnection, StreamPeerType) -> Unit)?, private val onIceCandidate: ((IceCandidate, StreamPeerType) -> Unit)?, - private val onVideoTrack: ((RtpTransceiver?) -> Unit)? + private val onVideoTrack: ((RtpTransceiver?) -> Unit)?, ) : PeerConnection.Observer { private val typeTag = type.stringify() @@ -133,19 +133,25 @@ class StreamPeerConnection( * @return An empty [Result], if the operation has been successful or not. */ suspend fun setRemoteDescription(sessionDescription: SessionDescription): Result { - logger.d { "[setRemoteDescription] #sfu; #$typeTag; answerSdp: ${sessionDescription.stringify()}" } + logger.d { + "[setRemoteDescription] #sfu; #$typeTag; " + + "answerSdp: ${sessionDescription.stringify()}" + } return suspendSdpObserver { connection.setRemoteDescription( it, SessionDescription( sessionDescription.type, - sessionDescription.description.mungeCodecs() - ) + sessionDescription.description.mungeCodecs(), + ), ) }.also { pendingIceMutex.withLock { pendingIceCandidates.forEach { iceCandidate -> - logger.i { "[setRemoteDescription] #sfu; #subscriber; pendingRtcIceCandidate: $iceCandidate" } + logger.i { + "[setRemoteDescription] #sfu; #subscriber; " + + "pendingRtcIceCandidate: $iceCandidate" + } connection.addRtcIceCandidate(iceCandidate) } pendingIceCandidates.clear() @@ -163,9 +169,12 @@ class StreamPeerConnection( suspend fun setLocalDescription(sessionDescription: SessionDescription): Result { val sdp = SessionDescription( sessionDescription.type, - sessionDescription.description.mungeCodecs() + sessionDescription.description.mungeCodecs(), ) - logger.d { "[setLocalDescription] #sfu; #$typeTag; offerSdp: ${sessionDescription.stringify()}" } + logger.d { + "[setLocalDescription] #sfu; #$typeTag; " + + "offerSdp: ${sessionDescription.stringify()}" + } return suspendSdpObserver { connection.setLocalDescription(it, sdp) } } @@ -178,7 +187,10 @@ class StreamPeerConnection( */ suspend fun addIceCandidate(iceCandidate: IceCandidate): Result { if (connection.remoteDescription == null) { - logger.w { "[addIceCandidate] #sfu; #$typeTag; postponed (no remoteDescription): $iceCandidate" } + logger.w { + "[addIceCandidate] #sfu; #$typeTag;" + + " postponed (no remoteDescription): $iceCandidate" + } pendingIceMutex.withLock { pendingIceCandidates.add(iceCandidate) } @@ -231,7 +243,10 @@ class StreamPeerConnection( mediaStreams?.forEach { mediaStream -> logger.v { "[onAddTrack] #sfu; #$typeTag; mediaStream: $mediaStream" } mediaStream.audioTracks?.forEach { remoteAudioTrack -> - logger.v { "[onAddTrack] #sfu; #$typeTag; remoteAudioTrack: ${remoteAudioTrack.stringify()}" } + logger.v { + "[onAddTrack] #sfu; #$typeTag; " + + "remoteAudioTrack: ${remoteAudioTrack.stringify()}" + } remoteAudioTrack.setEnabled(true) } onStreamAdded?.invoke(mediaStream) @@ -263,7 +278,9 @@ class StreamPeerConnection( when (newState) { PeerConnection.IceConnectionState.CLOSED, PeerConnection.IceConnectionState.FAILED, - PeerConnection.IceConnectionState.DISCONNECTED -> statsJob?.cancel() + PeerConnection.IceConnectionState.DISCONNECTED, + -> statsJob?.cancel() + PeerConnection.IceConnectionState.CONNECTED -> statsJob = observeStats() else -> Unit } @@ -335,6 +352,7 @@ class StreamPeerConnection( "StreamPeerConnection(type='$typeTag', constraints=$mediaConstraints)" private fun String.mungeCodecs(): String { - return this.replace("vp9", "VP9").replace("vp8", "VP8").replace("h264", "H264") + return this.replace("vp9", "VP9") + .replace("vp8", "VP8").replace("h264", "H264") } } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnectionFactory.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnectionFactory.kt index ad2af869..ead5884c 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnectionFactory.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerConnectionFactory.kt @@ -39,7 +39,7 @@ import org.webrtc.VideoTrack import org.webrtc.audio.JavaAudioDeviceModule class StreamPeerConnectionFactory constructor( - private val context: Context + private val context: Context, ) { private val webRtcLogger by taggedLogger("Call:WebRTC") private val audioLogger by taggedLogger("Call:AudioTrackCallback") @@ -53,7 +53,7 @@ class StreamPeerConnectionFactory constructor( */ private val videoDecoderFactory by lazy { DefaultVideoDecoderFactory( - eglBaseContext + eglBaseContext, ) } @@ -61,8 +61,8 @@ class StreamPeerConnectionFactory constructor( val rtcConfig = PeerConnection.RTCConfiguration( arrayListOf( // adding google's standard server - PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer() - ) + PeerConnection.IceServer.builder("stun:stun.l.google.com:19302").createIceServer(), + ), ).apply { // it's very important to use new unified sdp semantics PLAN_B is deprecated sdpSemantics = PeerConnection.SdpSemantics.UNIFIED_PLAN @@ -103,7 +103,7 @@ class StreamPeerConnectionFactory constructor( else -> {} } }, Logging.Severity.LS_VERBOSE) - .createInitializationOptions() + .createInitializationOptions(), ) PeerConnectionFactory.builder() @@ -115,63 +115,63 @@ class StreamPeerConnectionFactory constructor( .setUseHardwareAcousticEchoCanceler(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) .setUseHardwareNoiseSuppressor(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) .setAudioRecordErrorCallback(object : - JavaAudioDeviceModule.AudioRecordErrorCallback { - override fun onWebRtcAudioRecordInitError(p0: String?) { - audioLogger.w { "[onWebRtcAudioRecordInitError] $p0" } - } + JavaAudioDeviceModule.AudioRecordErrorCallback { + override fun onWebRtcAudioRecordInitError(p0: String?) { + audioLogger.w { "[onWebRtcAudioRecordInitError] $p0" } + } - override fun onWebRtcAudioRecordStartError( - p0: JavaAudioDeviceModule.AudioRecordStartErrorCode?, - p1: String? - ) { - audioLogger.w { "[onWebRtcAudioRecordInitError] $p1" } - } + override fun onWebRtcAudioRecordStartError( + p0: JavaAudioDeviceModule.AudioRecordStartErrorCode?, + p1: String?, + ) { + audioLogger.w { "[onWebRtcAudioRecordInitError] $p1" } + } - override fun onWebRtcAudioRecordError(p0: String?) { - audioLogger.w { "[onWebRtcAudioRecordError] $p0" } - } - }) + override fun onWebRtcAudioRecordError(p0: String?) { + audioLogger.w { "[onWebRtcAudioRecordError] $p0" } + } + }) .setAudioTrackErrorCallback(object : - JavaAudioDeviceModule.AudioTrackErrorCallback { - override fun onWebRtcAudioTrackInitError(p0: String?) { - audioLogger.w { "[onWebRtcAudioTrackInitError] $p0" } - } + JavaAudioDeviceModule.AudioTrackErrorCallback { + override fun onWebRtcAudioTrackInitError(p0: String?) { + audioLogger.w { "[onWebRtcAudioTrackInitError] $p0" } + } - override fun onWebRtcAudioTrackStartError( - p0: JavaAudioDeviceModule.AudioTrackStartErrorCode?, - p1: String? - ) { - audioLogger.w { "[onWebRtcAudioTrackStartError] $p0" } - } + override fun onWebRtcAudioTrackStartError( + p0: JavaAudioDeviceModule.AudioTrackStartErrorCode?, + p1: String?, + ) { + audioLogger.w { "[onWebRtcAudioTrackStartError] $p0" } + } - override fun onWebRtcAudioTrackError(p0: String?) { - audioLogger.w { "[onWebRtcAudioTrackError] $p0" } - } - }) + override fun onWebRtcAudioTrackError(p0: String?) { + audioLogger.w { "[onWebRtcAudioTrackError] $p0" } + } + }) .setAudioRecordStateCallback(object : - JavaAudioDeviceModule.AudioRecordStateCallback { - override fun onWebRtcAudioRecordStart() { - audioLogger.d { "[onWebRtcAudioRecordStart] no args" } - } + JavaAudioDeviceModule.AudioRecordStateCallback { + override fun onWebRtcAudioRecordStart() { + audioLogger.d { "[onWebRtcAudioRecordStart] no args" } + } - override fun onWebRtcAudioRecordStop() { - audioLogger.d { "[onWebRtcAudioRecordStop] no args" } - } - }) + override fun onWebRtcAudioRecordStop() { + audioLogger.d { "[onWebRtcAudioRecordStop] no args" } + } + }) .setAudioTrackStateCallback(object : - JavaAudioDeviceModule.AudioTrackStateCallback { - override fun onWebRtcAudioTrackStart() { - audioLogger.d { "[onWebRtcAudioTrackStart] no args" } - } + JavaAudioDeviceModule.AudioTrackStateCallback { + override fun onWebRtcAudioTrackStart() { + audioLogger.d { "[onWebRtcAudioTrackStart] no args" } + } - override fun onWebRtcAudioTrackStop() { - audioLogger.d { "[onWebRtcAudioTrackStop] no args" } - } - }) + override fun onWebRtcAudioTrackStop() { + audioLogger.d { "[onWebRtcAudioTrackStop] no args" } + } + }) .createAudioDeviceModule().also { it.setMicrophoneMute(false) it.setSpeakerMute(false) - } + }, ) .createPeerConnectionFactory() } @@ -198,7 +198,7 @@ class StreamPeerConnectionFactory constructor( onStreamAdded: ((MediaStream) -> Unit)? = null, onNegotiationNeeded: ((StreamPeerConnection, StreamPeerType) -> Unit)? = null, onIceCandidateRequest: ((IceCandidate, StreamPeerType) -> Unit)? = null, - onVideoTrack: ((RtpTransceiver?) -> Unit)? = null + onVideoTrack: ((RtpTransceiver?) -> Unit)? = null, ): StreamPeerConnection { val peerConnection = StreamPeerConnection( coroutineScope = coroutineScope, @@ -207,11 +207,11 @@ class StreamPeerConnectionFactory constructor( onStreamAdded = onStreamAdded, onNegotiationNeeded = onNegotiationNeeded, onIceCandidate = onIceCandidateRequest, - onVideoTrack = onVideoTrack + onVideoTrack = onVideoTrack, ) val connection = makePeerConnectionInternal( configuration = configuration, - observer = peerConnection + observer = peerConnection, ) return peerConnection.apply { initialize(connection) } } @@ -226,13 +226,13 @@ class StreamPeerConnectionFactory constructor( */ private fun makePeerConnectionInternal( configuration: PeerConnection.RTCConfiguration, - observer: PeerConnection.Observer? + observer: PeerConnection.Observer?, ): PeerConnection { return requireNotNull( factory.createPeerConnection( configuration, - observer - ) + observer, + ), ) } @@ -256,7 +256,7 @@ class StreamPeerConnectionFactory constructor( */ fun makeVideoTrack( source: VideoSource, - trackId: String + trackId: String, ): VideoTrack = factory.createVideoTrack(trackId, source) /** @@ -278,6 +278,6 @@ class StreamPeerConnectionFactory constructor( */ fun makeAudioTrack( source: AudioSource, - trackId: String + trackId: String, ): AudioTrack = factory.createAudioTrack(trackId, source) } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerType.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerType.kt index a83b78ff..f63d7a74 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerType.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/peer/StreamPeerType.kt @@ -22,5 +22,5 @@ package io.getstream.webrtc.sample.compose.webrtc.peer */ enum class StreamPeerType { PUBLISHER, - SUBSCRIBER + SUBSCRIBER, } diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/sessions/WebRtcSessionManagerImpl.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/sessions/WebRtcSessionManagerImpl.kt index b2b949ec..39a138b3 100644 --- a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/sessions/WebRtcSessionManagerImpl.kt +++ b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/sessions/WebRtcSessionManagerImpl.kt @@ -62,7 +62,7 @@ val LocalWebRtcSessionManager: ProvidableCompositionLocal class WebRtcSessionManagerImpl( private val context: Context, override val signalingClient: SignalingClient, - override val peerConnectionFactory: StreamPeerConnectionFactory + override val peerConnectionFactory: StreamPeerConnectionFactory, ) : WebRtcSessionManager { private val logger by taggedLogger("Call:LocalWebRtcSessionManager") @@ -82,8 +82,8 @@ class WebRtcSessionManagerImpl( mandatory.addAll( listOf( MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"), - MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true") - ) + MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"), + ), ) } @@ -108,7 +108,7 @@ class WebRtcSessionManagerImpl( // we need it to initialize video capturer private val surfaceTextureHelper = SurfaceTextureHelper.create( "SurfaceTextureHelperThread", - peerConnectionFactory.eglBaseContext + peerConnectionFactory.eglBaseContext, ) private val videoSource by lazy { @@ -121,7 +121,7 @@ class WebRtcSessionManagerImpl( private val localVideoTrack: VideoTrack by lazy { peerConnectionFactory.makeVideoTrack( source = videoSource, - trackId = "Video${UUID.randomUUID()}" + trackId = "Video${UUID.randomUUID()}", ) } @@ -146,7 +146,7 @@ class WebRtcSessionManagerImpl( private val localAudioTrack: AudioTrack by lazy { peerConnectionFactory.makeAudioTrack( source = audioSource, - trackId = "Audio${UUID.randomUUID()}" + trackId = "Audio${UUID.randomUUID()}", ) } @@ -161,7 +161,8 @@ class WebRtcSessionManagerImpl( onIceCandidateRequest = { iceCandidate, _ -> signalingClient.sendCommand( SignalingCommand.ICE, - "${iceCandidate.sdpMid}$ICE_SEPARATOR${iceCandidate.sdpMLineIndex}$ICE_SEPARATOR${iceCandidate.sdp}" + "${iceCandidate.sdpMid}$ICE_SEPARATOR" + + "${iceCandidate.sdpMLineIndex}$ICE_SEPARATOR${iceCandidate.sdp}", ) }, onVideoTrack = { rtpTransceiver -> @@ -172,7 +173,7 @@ class WebRtcSessionManagerImpl( _remoteVideoSinkFlow.emit(videoTrack) } } - } + }, ) } @@ -244,7 +245,7 @@ class WebRtcSessionManagerImpl( private suspend fun sendAnswer() { peerConnection.setRemoteDescription( - SessionDescription(SessionDescription.Type.OFFER, offer) + SessionDescription(SessionDescription.Type.OFFER, offer), ) val answer = peerConnection.createAnswer().getOrThrow() val result = peerConnection.setLocalDescription(answer) @@ -262,7 +263,7 @@ class WebRtcSessionManagerImpl( private suspend fun handleAnswer(sdp: String) { logger.d { "[SDP] handle answer: $sdp" } peerConnection.setRemoteDescription( - SessionDescription(SessionDescription.Type.ANSWER, sdp) + SessionDescription(SessionDescription.Type.ANSWER, sdp), ) } @@ -272,8 +273,8 @@ class WebRtcSessionManagerImpl( IceCandidate( iceArray[0], iceArray[1].toInt(), - iceArray[2] - ) + iceArray[2], + ), ) } @@ -307,24 +308,24 @@ class WebRtcSessionManagerImpl( val items = listOf( MediaConstraints.KeyValuePair( "googEchoCancellation", - true.toString() + true.toString(), ), MediaConstraints.KeyValuePair( "googAutoGainControl", - true.toString() + true.toString(), ), MediaConstraints.KeyValuePair( "googHighpassFilter", - true.toString() + true.toString(), ), MediaConstraints.KeyValuePair( "googNoiseSuppression", - true.toString() + true.toString(), ), MediaConstraints.KeyValuePair( "googTypingNoiseDetection", - true.toString() - ) + true.toString(), + ), ) return mediaConstraints.apply { diff --git a/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/utils/stringify.kt b/app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/utils/Stringify.kt similarity index 100% rename from app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/utils/stringify.kt rename to app/src/main/kotlin/io/getstream/webrtc/sample/compose/webrtc/utils/Stringify.kt diff --git a/benchmark/src/main/java/io/getstream/webrtc/android/benchmark/BaselineProfileGenerator.kt b/benchmark/src/main/java/io/getstream/webrtc/android/benchmark/BaselineProfileGenerator.kt index b1c80338..172121c7 100644 --- a/benchmark/src/main/java/io/getstream/webrtc/android/benchmark/BaselineProfileGenerator.kt +++ b/benchmark/src/main/java/io/getstream/webrtc/android/benchmark/BaselineProfileGenerator.kt @@ -34,7 +34,7 @@ class BaselineProfileGenerator { fun startup() = baselineProfileRule.collect( packageName = "io.getstream.webrtc.sample.compose", - includeInStartupProfile = true + includeInStartupProfile = true, ) { pressHome() // This block defines the app's critical user journey. Here we are interested in diff --git a/build.gradle.kts b/build.gradle.kts index f91743a4..46fdfc48 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,7 +26,7 @@ subprojects { kotlin { target("**/*.kt") targetExclude("$buildDir/**/*.kt") - ktlint().setUseExperimental(true).editorConfigOverride( + ktlint().editorConfigOverride( mapOf( "indent_size" to "2", "continuation_indent_size" to "2" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0f29f966..4eff9607 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -20,7 +20,7 @@ kotlin = "1.9.10" kotlinxCoroutines = "1.7.3" okhttp = "4.11.0" retrofit = "2.9.0" -spotless = "6.7.0" +spotless = "6.21.0" androidxMacroBenchmark = "1.2.0-rc02" androidxProfileinstaller = "1.3.1" androidxUiAutomator = "2.3.0-alpha04" diff --git a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/FloatingVideoRenderer.kt b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/FloatingVideoRenderer.kt index 23d47edd..a5f3d298 100644 --- a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/FloatingVideoRenderer.kt +++ b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/FloatingVideoRenderer.kt @@ -59,7 +59,7 @@ public fun FloatingVideoRenderer( parentBounds: IntSize, paddingValues: PaddingValues, eglBaseContext: EglBase.Context, - rendererEvents: RendererCommon.RendererEvents + rendererEvents: RendererCommon.RendererEvents, ) { var videoSize by remember { mutableStateOf(IntSize(0, 0)) } var offsetX by remember { mutableStateOf(0f) } @@ -89,11 +89,11 @@ public fun FloatingVideoRenderer( paddingValues = paddingValues, floatingVideoSize = videoSize, density = density, - offset = paddingOffset * 2 - ) + offset = paddingOffset * 2, + ), ) .coerceAtMost( - 0f + 0f, ) val newOffsetY = (offsetY + dragAmount.y) @@ -104,8 +104,8 @@ public fun FloatingVideoRenderer( paddingValues = paddingValues, floatingVideoSize = videoSize, density = density, - offset = paddingOffset * 2 - ) + offset = paddingOffset * 2, + ), ) offsetX = newOffsetX @@ -115,7 +115,7 @@ public fun FloatingVideoRenderer( .then(modifier) .padding(16.dp) .onGloballyPositioned { videoSize = it.size }, - shape = RoundedCornerShape(16.dp) + shape = RoundedCornerShape(16.dp), ) { VideoRenderer( modifier = Modifier @@ -123,7 +123,7 @@ public fun FloatingVideoRenderer( .clip(RoundedCornerShape(16.dp)), videoTrack = videoTrack, eglBaseContext = eglBaseContext, - rendererEvents = rendererEvents + rendererEvents = rendererEvents, ) } } @@ -133,7 +133,7 @@ private fun calculateHorizontalOffsetBounds( paddingValues: PaddingValues, floatingVideoSize: IntSize, density: Density, - offset: Float + offset: Float, ): Float { val rightPadding = density.run { paddingValues.calculateRightPadding(LayoutDirection.Ltr).toPx() } @@ -146,7 +146,7 @@ private fun calculateVerticalOffsetBounds( paddingValues: PaddingValues, floatingVideoSize: IntSize, density: Density, - offset: Float + offset: Float, ): Float { val bottomPadding = density.run { paddingValues.calculateBottomPadding().toPx() } diff --git a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoRenderer.kt b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoRenderer.kt index f69325ee..3c33836b 100644 --- a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoRenderer.kt +++ b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoRenderer.kt @@ -44,7 +44,7 @@ public fun VideoRenderer( eglBaseContext: Context, videoScalingType: VideoScalingType = VideoScalingType.SCALE_ASPECT_BALANCED, onTextureViewCreated: (VideoTextureViewRenderer) -> Unit = { }, - rendererEvents: RendererEvents + rendererEvents: RendererEvents, ) { val trackState: MutableState = remember { mutableStateOf(null) } var view: VideoTextureViewRenderer? by remember { mutableStateOf(null) } @@ -66,13 +66,13 @@ public fun VideoRenderer( } }, update = { v -> setupVideo(trackState, videoTrack, v) }, - modifier = modifier + modifier = modifier, ) } private fun cleanTrack( view: VideoTextureViewRenderer?, - trackState: MutableState + trackState: MutableState, ) { view?.let { trackState.value?.removeSink(it) } trackState.value = null @@ -81,7 +81,7 @@ private fun cleanTrack( private fun setupVideo( trackState: MutableState, track: VideoTrack, - renderer: VideoTextureViewRenderer + renderer: VideoTextureViewRenderer, ) { if (trackState.value == track) { return diff --git a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoScalingType.kt b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoScalingType.kt index 130875f9..9d83be35 100644 --- a/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoScalingType.kt +++ b/stream-webrtc-android-compose/src/main/kotlin/io/getstream/webrtc/android/compose/VideoScalingType.kt @@ -33,13 +33,14 @@ import org.webrtc.RendererCommon public enum class VideoScalingType { SCALE_ASPECT_FIT, SCALE_ASPECT_FILL, - SCALE_ASPECT_BALANCED; + SCALE_ASPECT_BALANCED, + ; public companion object { @Deprecated( message = "Use SCALE_ASPECT_FILL instead", - replaceWith = ReplaceWith("VideoScalingType.SCALE_ASPECT_FILL") + replaceWith = ReplaceWith("VideoScalingType.SCALE_ASPECT_FILL"), ) @JvmField public val SCAPE_ASPECT_FILL: VideoScalingType = SCALE_ASPECT_FILL diff --git a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/PeerConnectionExtensions.kt b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/PeerConnectionExtensions.kt index 25457e70..cffb729b 100644 --- a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/PeerConnectionExtensions.kt +++ b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/PeerConnectionExtensions.kt @@ -40,7 +40,7 @@ public suspend fun PeerConnection.addRtcIceCandidate(iceCandidate: IceCandidate) override fun onAddFailure(error: String?) { cont.resume(Result.failure(WebRTCException(message = error))) } - } + }, ) } } diff --git a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/SDPExtensions.kt b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/SDPExtensions.kt index 6a69f822..f9c89c97 100644 --- a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/SDPExtensions.kt +++ b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/SDPExtensions.kt @@ -22,7 +22,7 @@ import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine public suspend inline fun createSessionDescription( - crossinline call: (SdpObserver) -> Unit + crossinline call: (SdpObserver) -> Unit, ): Result = suspendCoroutine { val observer = object : SdpObserver { @@ -57,7 +57,7 @@ public suspend inline fun createSessionDescription( } public suspend inline fun suspendSdpObserver( - crossinline call: (SdpObserver) -> Unit + crossinline call: (SdpObserver) -> Unit, ): Result = suspendCoroutine { val observer = object : SdpObserver { /** diff --git a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/stringify.kt b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/Stringify.kt similarity index 96% rename from stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/stringify.kt rename to stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/Stringify.kt index a2d3d394..18cb3ada 100644 --- a/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/stringify.kt +++ b/stream-webrtc-android-ktx/src/main/kotlin/io/getstream/webrtc/android/ktx/Stringify.kt @@ -29,7 +29,8 @@ public fun MediaStreamTrack.stringify(): String { } public fun IceCandidateErrorEvent.stringify(): String { - return "IceCandidateErrorEvent(errorCode=$errorCode, $errorText, address=$address, port=$port, url=$url)" + return "IceCandidateErrorEvent(errorCode=$errorCode, $errorText, " + + "address=$address, port=$port, url=$url)" } public fun JavaAudioDeviceModule.AudioSamples.stringify(): String { diff --git a/stream-webrtc-android-ui/src/main/kotlin/io/getstream/webrtc/android/ui/VideoTextureViewRenderer.kt b/stream-webrtc-android-ui/src/main/kotlin/io/getstream/webrtc/android/ui/VideoTextureViewRenderer.kt index 2f412175..01eaf6a5 100644 --- a/stream-webrtc-android-ui/src/main/kotlin/io/getstream/webrtc/android/ui/VideoTextureViewRenderer.kt +++ b/stream-webrtc-android-ui/src/main/kotlin/io/getstream/webrtc/android/ui/VideoTextureViewRenderer.kt @@ -41,7 +41,7 @@ import java.util.concurrent.CountDownLatch */ public open class VideoTextureViewRenderer @JvmOverloads constructor( context: Context, - attrs: AttributeSet? = null + attrs: AttributeSet? = null, ) : TextureView(context, attrs), VideoSink, SurfaceTextureListener { /** @@ -116,7 +116,7 @@ public open class VideoTextureViewRenderer @JvmOverloads constructor( */ public fun setScalingType( scalingTypeMatchOrientation: ScalingType?, - scalingTypeMismatchOrientation: ScalingType? + scalingTypeMismatchOrientation: ScalingType?, ) { ThreadUtils.checkIsOnMainThread() videoLayoutMeasure.setScalingType(scalingTypeMatchOrientation, scalingTypeMismatchOrientation) @@ -164,7 +164,7 @@ public open class VideoTextureViewRenderer @JvmOverloads constructor( rendererEvents?.onFrameResolutionChanged( rotatedFrameWidth, rotatedFrameHeight, - frameRotation + frameRotation, ) } } @@ -186,7 +186,7 @@ public open class VideoTextureViewRenderer @JvmOverloads constructor( */ public fun init( sharedContext: EglBase.Context, - rendererEvents: RendererEvents + rendererEvents: RendererEvents, ) { ThreadUtils.checkIsOnMainThread() this.rendererEvents = rendererEvents @@ -224,7 +224,7 @@ public open class VideoTextureViewRenderer @JvmOverloads constructor( override fun onSurfaceTextureSizeChanged( surfaceTexture: SurfaceTexture, width: Int, - height: Int + height: Int, ) { }