Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,8 @@ class MediaManagerImpl(
*
* Once released, [runOnAudioTrackIfAvailable] / [runOnVideoTrackIfAvailable] become no-ops. Set
* only on the terminal [cleanup] path and NOT in [disposeTracksAndSources], because
* [Call.recreateFactoryAndAudioTracks] disposes and then deliberately recreates before joining.
* CallMediaManager.recreateFactoryAndAudioTracks disposes and then deliberately recreates
* before joining.
*/
private var released = false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import io.getstream.video.android.core.StreamVideoClient
import io.getstream.video.android.core.analytics.call.observer.SfuAnalytics
import io.getstream.video.android.core.analytics.reporting.model.AnalyticsCallAbortReason
import io.getstream.video.android.core.call.components.CallSessionManager
import io.getstream.video.android.core.call.connection.Publisher
import io.getstream.video.android.core.call.connection.StreamPeerConnection
import io.getstream.video.android.core.call.connection.Subscriber
Expand Down Expand Up @@ -255,6 +256,7 @@
private val sessionCounter: Int = 0,
private val powerManager: PowerManager?,
private val call: Call,
private val sessionManager: CallSessionManager,
private val sessionId: String,
private val apiKey: String,
private val lifecycle: Lifecycle,
Expand Down Expand Up @@ -554,8 +556,8 @@
private val connectionConfiguration: PeerConnection.RTCConfiguration
get() = buildConnectionConfiguration(iceServers)

internal val subscriber: MutableStateFlow<Subscriber?> = MutableStateFlow(null)

Check warning on line 559 in stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Don't expose mutable flow types.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ_HnTx-1Yt1fFEnyE_A&open=AZ_HnTx-1Yt1fFEnyE_A&pullRequest=1747
internal val publisher: MutableStateFlow<Publisher?> = MutableStateFlow(null)

Check warning on line 560 in stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Don't expose mutable flow types.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ_HnTx-1Yt1fFEnyE_B&open=AZ_HnTx-1Yt1fFEnyE_B&pullRequest=1747

internal lateinit var sfuConnectionModule: SfuConnectionModule

Expand Down Expand Up @@ -778,7 +780,7 @@
}
}

private fun startIceMonitoring() {

Check failure on line 783 in stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 17 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ_HnTx-1Yt1fFEnyE_D&open=AZ_HnTx-1Yt1fFEnyE_D&pullRequest=1747
if (iceMonitoringJob?.isActive == true) return
iceMonitoringJob = coroutineScope.launch {
val badIceStates = setOf(
Expand Down Expand Up @@ -902,7 +904,7 @@
message = "Use connectInternal() which returns SfuConnectionResult instead of throwing.",
replaceWith = ReplaceWith("connectInternal(reconnectDetails, options)"),
)
suspend fun connect(

Check warning on line 907 in stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not forget to remove this deprecated code someday.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ_HnTx-1Yt1fFEnyE_C&open=AZ_HnTx-1Yt1fFEnyE_C&pullRequest=1747
reconnectDetails: ReconnectDetails? = null,
options: List<PublishOption>? = null,
) {
Expand Down Expand Up @@ -1056,7 +1058,7 @@
): JoinRequest = JoinRequest(
subscriber_sdp = throwawaySubscriberSdpAndOptions(),
publisher_sdp = throwawayPublisherSdpAndOptions(),
unified_session_id = call.unifiedSessionId,
unified_session_id = sessionManager.unifiedSessionId,
session_id = sessionId,
token = sfuToken,
fast_reconnect = false,
Expand All @@ -1071,13 +1073,13 @@
if (reconnectStrategy == null) {
sendCallStats(
report = call.collectStats(),
connectionTimeSeconds = (System.currentTimeMillis() - call.connectStartTime) / 1000f,
connectionTimeSeconds = sessionManager.connectionTimeSeconds(),
)
} else {
sendCallStats(
report = call.collectStats(),
reconnectionTimeSeconds = Pair(
(System.currentTimeMillis() - call.reconnectStartTime) / 1000f,
sessionManager.reconnectionTimeSeconds(),
reconnectStrategy,
),
)
Expand Down Expand Up @@ -1597,7 +1599,7 @@
paused = false,
)

if (event.trackType == TrackType.TRACK_TYPE_AUDIO) {

Check warning on line 1602 in stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/call/RtcSession.kt

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Merge this "if" statement with the nested one.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ_HnTx-1Yt1fFEnyE_E&open=AZ_HnTx-1Yt1fFEnyE_E&pullRequest=1747
if (event.sessionId == sessionId) {
val isMicDisabled = !call.mediaManager.microphone.isEnabled.value
if (isMicDisabled) {
Expand Down Expand Up @@ -1899,7 +1901,7 @@
val sendStatsRequest = SendStatsRequest(
session_id = sessionId,
sdk = "stream-android",
unified_session_id = call.unifiedSessionId,
unified_session_id = sessionManager.unifiedSessionId,
sdk_version = BuildConfig.STREAM_VIDEO_VERSION,
webrtc_version = BuildConfig.STREAM_WEBRTC_VERSION,
publisher_stats = report?.toJson(StreamPeerType.PUBLISHER) ?: "",
Expand Down Expand Up @@ -1999,7 +2001,7 @@
subscriber.value?.setTrackDimension(viewportId, sessionId, trackType, visible, dimensions)
coroutineScope.launch {
serialProcessor.submit("updateTrackDimensions") {
if (sessionId != call.sessionId) {
if (sessionId != sessionManager.sessionId) {
// dimension updated for another participant
subscriber.value?.setVideoSubscriptions(
trackOverridesHandler,
Expand Down
Loading
Loading