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

Commit

Permalink
fix bug in connect function
Browse files Browse the repository at this point in the history
  • Loading branch information
karkakol committed Jan 23, 2024
1 parent ad69a11 commit 1e591c3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Sources/MembraneRTC/MembraneRTC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public class MembraneRTC: MulticastDelegate<MembraneRTCDelegate>, ObservableObje
return
}

localEndpoint = localEndpoint.with(metadata: metadata, tracks: [:])
localEndpoint = localEndpoint.with(metadata: metadata)

engineCommunication.connect(metadata: metadata)
}
Expand Down Expand Up @@ -470,7 +470,9 @@ public class MembraneRTC: MulticastDelegate<MembraneRTCDelegate>, ObservableObje

// initialize peer's track contexts
endpoint.tracks?.forEach { trackId, trackData in
let context = TrackContext(track: nil, enpoint: endpoint, trackId: trackId, metadata: trackData.metadata, simulcastConfig: trackData.simulcastConfig)
let context = TrackContext(
track: nil, enpoint: endpoint, trackId: trackId, metadata: trackData.metadata,
simulcastConfig: trackData.simulcastConfig)

self.trackContexts[trackId] = context

Expand Down Expand Up @@ -560,7 +562,8 @@ public class MembraneRTC: MulticastDelegate<MembraneRTCDelegate>, ObservableObje

if let sdp = sdp, let midToTrackId = midToTrackId {
self.engineCommunication.sdpOffer(
sdp: sdp, trackIdToTrackMetadata: self.localEndpoint.tracks?.mapValues({ trackData in
sdp: sdp,
trackIdToTrackMetadata: self.localEndpoint.tracks?.mapValues({ trackData in
trackData.metadata
}) ?? [:],
midToTrackId: midToTrackId)
Expand Down Expand Up @@ -596,7 +599,9 @@ public class MembraneRTC: MulticastDelegate<MembraneRTCDelegate>, ObservableObje

// for each track create a corresponding track context
endpoint.tracks?.forEach { trackId, trackData in
let context = TrackContext(track: nil, enpoint: endpoint, trackId: trackId, metadata: trackData.metadata, simulcastConfig: trackData.simulcastConfig)
let context = TrackContext(
track: nil, enpoint: endpoint, trackId: trackId, metadata: trackData.metadata,
simulcastConfig: trackData.simulcastConfig)

self.trackContexts[trackId] = context

Expand Down

0 comments on commit 1e591c3

Please sign in to comment.