Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
add can update metadata flag in InternalMembraneRTC
Browse files Browse the repository at this point in the history
  • Loading branch information
karkakol committed Jun 5, 2024
1 parent e80328d commit 5302aaa
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ internal class InternalMembraneRTC(

private val localTracks = mutableListOf<LocalTrack>()
private val localTracksMutex = Mutex()
private var canUpdateMetadata = false

private val coroutineScope: CoroutineScope =
ClosableCoroutineScope(SupervisorJob() + defaultDispatcher)
Expand All @@ -74,6 +75,7 @@ internal class InternalMembraneRTC(
localTracks.forEach { it.stop() }
}
peerConnectionManager.close()
canUpdateMetadata=false
}
}

Expand Down Expand Up @@ -210,6 +212,7 @@ internal class InternalMembraneRTC(
}

fun updateEndpointMetadata(endpointMetadata: Metadata) {
if(!canUpdateMetadata)return
coroutineScope.launch {
rtcEngineCommunication.updateEndpointMetadata(endpointMetadata)
localEndpoint = localEndpoint.copy(metadata = endpointMetadata)
Expand All @@ -220,6 +223,7 @@ internal class InternalMembraneRTC(
trackId: String,
trackMetadata: Metadata
) {
if(!canUpdateMetadata)return
coroutineScope.launch {
rtcEngineCommunication.updateTrackMetadata(trackId, trackMetadata)
localEndpoint = localEndpoint.withTrack(trackId, trackMetadata)
Expand Down Expand Up @@ -347,6 +351,7 @@ internal class InternalMembraneRTC(
}
}
}
canUpdateMetadata = true
}
}
}
Expand Down

0 comments on commit 5302aaa

Please sign in to comment.