Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
eb5c9a2
New publisher
aleksandar-apostolov Dec 20, 2024
b2a6455
map svc codec correctly
aleksandar-apostolov Dec 20, 2024
41643a8
Set codec
aleksandar-apostolov Dec 20, 2024
422db6e
Send correct layers
aleksandar-apostolov Dec 21, 2024
95b2171
Spotless & Api dump
aleksandar-apostolov Dec 21, 2024
9df3be8
Correctly update, publish options, send all three layers correctly, r…
aleksandar-apostolov Dec 23, 2024
72cac16
Spotless and apidump
aleksandar-apostolov Dec 23, 2024
70e9aba
Remove unnecessary tests
aleksandar-apostolov Dec 23, 2024
57ecaa7
Make the layers functions internal
aleksandar-apostolov Dec 23, 2024
465d897
Api dump
aleksandar-apostolov Dec 23, 2024
7c9df81
Remove code
aleksandar-apostolov Dec 23, 2024
e203b72
Correctly compute encodings and layers based on spatial layers, add test
aleksandar-apostolov Dec 23, 2024
63cdb38
Remove unused code in transceiver cache and add tests
aleksandar-apostolov Dec 23, 2024
e62fbef
Remove old dynascale test
aleksandar-apostolov Dec 23, 2024
4eaf8d3
Remove lscale test, add mini publisher test
aleksandar-apostolov Dec 23, 2024
568a0c0
Spotless & ApiDump and import cleanup
aleksandar-apostolov Dec 23, 2024
d703991
Additional cleanup
aleksandar-apostolov Dec 23, 2024
6c9f4a5
Update on layer calculation and tests
aleksandar-apostolov Dec 23, 2024
65791ee
Add codec to track info.
aleksandar-apostolov Dec 23, 2024
4bbcda2
Spotless & ApiDump
aleksandar-apostolov Dec 23, 2024
2119608
Remove transceiver when stream is unpublished
aleksandar-apostolov Dec 23, 2024
4abf268
Log encodings
aleksandar-apostolov Dec 23, 2024
c0e279a
Spotless ApiDump
aleksandar-apostolov Dec 23, 2024
286abb6
Spotless ApiDump
aleksandar-apostolov Dec 23, 2024
7018b6c
Merge remote-tracking branch 'refs/remotes/origin/develop' into AND-1…
aleksandar-apostolov Dec 30, 2024
d4b2f1a
Do not calculate layers for audio tracks
aleksandar-apostolov Dec 30, 2024
25c1ae5
Spotless
aleksandar-apostolov Dec 30, 2024
f109560
Merge branch 'refs/heads/develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Dec 31, 2024
0c27975
Update initial screenshare resolution
aleksandar-apostolov Dec 31, 2024
de9dfb4
Use PCF from call
aleksandar-apostolov Dec 31, 2024
3298c4b
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Dec 31, 2024
227c73e
Merge branch 'refs/heads/develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 3, 2025
2fe09db
Send publish options Id with the track info
aleksandar-apostolov Jan 3, 2025
d06be8d
Api dump
aleksandar-apostolov Jan 3, 2025
1dff059
Merge remote-tracking branch 'refs/remotes/origin/develop' into AND-1…
aleksandar-apostolov Jan 8, 2025
6cdbfc3
Cache publisher events in case publisher is not created yet.
aleksandar-apostolov Jan 9, 2025
116542f
setTrack instead of add new transceiver when there is already publish…
aleksandar-apostolov Jan 9, 2025
7dbef6d
Merge branch 'refs/heads/develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 10, 2025
36cf61e
remove commented code
aleksandar-apostolov Jan 10, 2025
4b7cb38
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 10, 2025
5585d58
Update package name of video layers
aleksandar-apostolov Jan 10, 2025
40c0ed8
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 10, 2025
dd39861
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 10, 2025
851cf56
Update package in test
aleksandar-apostolov Jan 10, 2025
047db25
Update publisher tests
aleksandar-apostolov Jan 13, 2025
afe025b
Minimal SPC test
aleksandar-apostolov Jan 13, 2025
2e17290
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 13, 2025
ffa0e04
Merge branch 'develop' into AND-18-codec-negotiation-rewrite
aleksandar-apostolov Jan 13, 2025
1da4087
Spotless & Apidump
aleksandar-apostolov Jan 13, 2025
8d84900
Merge remote-tracking branch 'origin/AND-18-codec-negotiation-rewrite…
aleksandar-apostolov Jan 13, 2025
e486842
Add minimal SPC Factory tests
aleksandar-apostolov Jan 13, 2025
c8d8f20
Fix wildcard imports
aleksandar-apostolov Jan 13, 2025
7928037
Spotless & ApiDump
aleksandar-apostolov Jan 13, 2025
0bff5ca
Add SPC test for the init parameters
aleksandar-apostolov Jan 13, 2025
36c5631
Add more tests for RTC session
aleksandar-apostolov Jan 14, 2025
272ed88
Remove wildcard imports
aleksandar-apostolov Jan 14, 2025
db44f19
Remove wildcard imports
aleksandar-apostolov Jan 14, 2025
a8e7ab2
Reformatting
aleksandar-apostolov Jan 14, 2025
d2410f1
Fix failing tests
aleksandar-apostolov Jan 14, 2025
a301ffb
Formatting
aleksandar-apostolov Jan 14, 2025
64373ec
Add change quality test
aleksandar-apostolov Jan 14, 2025
519be2b
Spotless & ApiDump
aleksandar-apostolov Jan 14, 2025
bceb698
Correctly test empty encodings
aleksandar-apostolov Jan 14, 2025
f81d7fa
Formatting
aleksandar-apostolov Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 95 additions & 16 deletions stream-video-android-core/api/stream-video-android-core.api

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions stream-video-android-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ dependencies {
implementation(libs.tink)

// unit tests
testImplementation(libs.stream.result)
testImplementation(libs.stream.result.call)
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(libs.mockk)
Expand All @@ -206,6 +208,10 @@ dependencies {
testImplementation(libs.kotlin.test.junit)
testImplementation(libs.kotlinx.coroutines.debug)
testImplementation(libs.kotlinx.serialization.converter)
testImplementation(libs.retrofit)
testImplementation(libs.retrofit.moshi)
testImplementation(libs.retrofit.scalars)
testImplementation(libs.retrofit.wire.converter)

// instrument tests
androidTestImplementation(libs.stream.log.android)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import com.google.common.truth.Truth.assertThat
import io.getstream.log.taggedLogger
import io.getstream.video.android.core.api.SignalServerService
import io.getstream.video.android.core.call.video.FilterVideoProcessor
import io.getstream.video.android.core.events.ChangePublishQualityEvent
import io.getstream.video.android.core.events.ParticipantJoinedEvent
import io.getstream.video.android.core.utils.buildAudioConstraints
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.runTest
Expand All @@ -41,12 +39,6 @@ import org.webrtc.RTCStats
import org.webrtc.VideoCodecInfo
import retrofit2.Retrofit
import retrofit2.converter.wire.WireConverterFactory
import stream.video.sfu.event.ChangePublishQuality
import stream.video.sfu.event.VideoLayerSetting
import stream.video.sfu.event.VideoMediaRequest
import stream.video.sfu.event.VideoSender
import stream.video.sfu.models.Participant
import stream.video.sfu.models.TrackType
import stream.video.sfu.signal.UpdateMuteStatesRequest
import java.io.IOException
import java.io.InterruptedIOException
Expand Down Expand Up @@ -525,79 +517,4 @@ class AndroidDeviceTest : IntegrationTestBase(connectCoordinatorWS = false) {
// clean up a call
call.cleanup()
}

@Test
fun dynascale() = runTest {
// join will automatically start the audio and video capture
// based on the call settings
val joinResult = call.join(create = true)
assertSuccess(joinResult)

// create a turbine connection state
val connectionState = call.state.connection.testIn(backgroundScope)
// asset that the connection state is connected
val connectionStateItem = connectionState.awaitItem()
assertThat(connectionStateItem).isAnyOf(
RealtimeConnection.Connected,
RealtimeConnection.Joined(joinResult.getOrThrow()),
)
if (connectionStateItem is RealtimeConnection.Joined) {
connectionState.awaitItem()
}

// fake a participant joining
val joinEvent = ParticipantJoinedEvent(
callCid = call.cid,
participant = Participant(session_id = "fake", user_id = "fake"),
)
clientImpl.fireEvent(joinEvent, call.cid)

val participantsState = call.state.participants.testIn(backgroundScope)
val participants = participantsState.awaitItem()
assertThat(participants.size).isEqualTo(2)

val remoteParticipants = call.state.remoteParticipants.testIn(backgroundScope)
assertThat(remoteParticipants.awaitItem().size).isEqualTo(1)

val sortedParticipants = call.state.sortedParticipants.testIn(backgroundScope)
assertThat(sortedParticipants.awaitItem().size).isEqualTo(2)

// set their video as visible
call.setVisibility(sessionId = "fake", TrackType.TRACK_TYPE_VIDEO, true)
call.setVisibility(sessionId = "fake", TrackType.TRACK_TYPE_SCREEN_SHARE, true)

// val tracks1 = call.session?.defaultTracks()
// val tracks2 = call.session?.visibleTracks()
//
// assertThat(tracks1?.size).isEqualTo(2)
// assertThat(tracks1?.map { it.session_id }).contains("fake")
// assertThat(tracks2?.size).isEqualTo(2)
// assertThat(tracks2?.map { it.session_id }).contains("fake")
//
// // if their video isn't visible it shouldn't be in the tracks
// call.setVisibility(sessionId = "fake", TrackType.TRACK_TYPE_VIDEO, false)
// val tracks3 = call.session?.visibleTracks()
// assertThat(tracks3?.size).isEqualTo(1)

// test handling publish quality change
val mediaRequest = VideoMediaRequest()
val layers = listOf(
VideoLayerSetting(name = "f", active = false),
VideoLayerSetting(name = "h", active = true),
VideoLayerSetting(name = "q", active = false),
)
val quality = ChangePublishQuality(
video_senders = listOf(
VideoSender(
media_request = mediaRequest,
layers = layers,
),
),
)
val event = ChangePublishQualityEvent(changePublishQuality = quality)
call.session?.updatePublishQuality(event)

// clean up a call
call.cleanup()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public class Call(
private var callStatsReportingJob: Job? = null
private var powerManager: PowerManager? = null

private val scope = CoroutineScope(clientImpl.scope.coroutineContext + supervisorJob)
internal val scope = CoroutineScope(clientImpl.scope.coroutineContext + supervisorJob)

/** The call state contains all state such as the participant list, reactions etc */
val state = CallState(client, this, user, scope)
Expand Down Expand Up @@ -661,6 +661,7 @@ public class Call(
// switch to the new SFU
val cred = joinResponse.value.credentials
val session = this.session!!
val currentOptions = this.session?.publisher?.currentOptions()
logger.i { "Rejoin SFU ${session?.sfuUrl} to ${cred.server.url}" }

this.sessionId = UUID.randomUUID().toString()
Expand Down Expand Up @@ -688,7 +689,7 @@ public class Call(
ice.toIceServer()
},
)
this.session?.connect(reconnectDetails)
this.session?.connect(reconnectDetails, currentOptions)
session.cleanup()
monitorSession(joinResponse.value)
} else {
Expand All @@ -714,6 +715,7 @@ public class Call(
// switch to the new SFU
val cred = joinResponse.value.credentials
val session = this.session!!
val currentOptions = this.session?.publisher?.currentOptions()
val oldSfuUrl = session.sfuUrl
logger.i { "Rejoin SFU $oldSfuUrl to ${cred.server.url}" }

Expand Down Expand Up @@ -744,7 +746,7 @@ public class Call(
)
val oldSession = this.session
this.session = newSession
this.session?.connect(reconnectDetails)
this.session?.connect(reconnectDetails, currentOptions)
monitorSession(joinResponse.value)
oldSession?.leaveWithReason("migrating")
oldSession?.cleanup()
Expand Down Expand Up @@ -1384,7 +1386,7 @@ public class Call(

fun fastReconnect() {
call.scope.launch {
call.rejoin()
call.fastReconnect()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -844,27 +844,24 @@ class MediaManagerImpl(
val videoSource =
call.peerConnectionFactory.makeVideoSource(false, filterVideoProcessor)

val screenShareVideoSource by lazy {
val screenShareVideoSource =
call.peerConnectionFactory.makeVideoSource(true, screenShareFilterVideoProcessor)
}

// for track ids we emulate the browser behaviour of random UUIDs, doing something different would be confusing
val videoTrack = call.peerConnectionFactory.makeVideoTrack(
var videoTrack = call.peerConnectionFactory.makeVideoTrack(
source = videoSource,
trackId = UUID.randomUUID().toString(),
)

val screenShareTrack by lazy {
call.peerConnectionFactory.makeVideoTrack(
source = screenShareVideoSource,
trackId = UUID.randomUUID().toString(),
)
}
var screenShareTrack = call.peerConnectionFactory.makeVideoTrack(
source = screenShareVideoSource,
trackId = UUID.randomUUID().toString(),
)

val audioSource = call.peerConnectionFactory.makeAudioSource(buildAudioConstraints())

// for track ids we emulate the browser behaviour of random UUIDs, doing something different would be confusing
val audioTrack = call.peerConnectionFactory.makeAudioTrack(
var audioTrack = call.peerConnectionFactory.makeAudioTrack(
source = audioSource,
trackId = UUID.randomUUID().toString(),
)
Expand Down
Loading
Loading