This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unnecesary track id to metadata property and export TrackData …
…to separate file
- Loading branch information
Showing
6 changed files
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 8 additions & 9 deletions
17
MembraneRTC/src/main/java/org/membraneframework/rtc/models/Endpoint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
package org.membraneframework.rtc.models | ||
|
||
import org.membraneframework.rtc.events.TracksAdded | ||
import org.membraneframework.rtc.utils.Metadata | ||
|
||
data class Endpoint( | ||
val id: String, | ||
val type: String, | ||
val metadata: Metadata? = mapOf(), | ||
val trackIdToMetadata: Map<String, Metadata?> = mapOf(), | ||
val tracks: Map<String, TracksAdded.Data.TrackData> | ||
val tracks: Map<String, TrackData> = mapOf(), | ||
) { | ||
fun withTrack( | ||
trackId: String, | ||
metadata: Metadata? | ||
): Endpoint { | ||
val newTrackIdToMetadata = this.trackIdToMetadata.toMutableMap() | ||
newTrackIdToMetadata[trackId] = metadata ?: mapOf() | ||
return this.copy(trackIdToMetadata = newTrackIdToMetadata) | ||
val tracks = this.tracks.toMutableMap() | ||
val trackData = tracks[trackId] | ||
tracks[trackId] = TrackData(metadata = metadata, simulcastConfig = trackData?.simulcastConfig); | ||
return this.copy(tracks = tracks) | ||
} | ||
|
||
fun withoutTrack(trackId: String): Endpoint { | ||
val newTrackIdToMetadata = this.trackIdToMetadata.toMutableMap() | ||
newTrackIdToMetadata.remove(trackId) | ||
return this.copy(trackIdToMetadata = newTrackIdToMetadata) | ||
val tracks = this.tracks.toMutableMap() | ||
tracks.remove(trackId) | ||
return this.copy(tracks = tracks) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
MembraneRTC/src/main/java/org/membraneframework/rtc/models/TrackData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.membraneframework.rtc.models | ||
|
||
import org.membraneframework.rtc.SimulcastConfig | ||
import org.membraneframework.rtc.utils.Metadata | ||
|
||
data class TrackData(val metadata: Metadata?, val simulcastConfig: SimulcastConfig?){ | ||
|
||
} |