diff --git a/relay.go b/relay.go index 1816fd7..7ed7a53 100644 --- a/relay.go +++ b/relay.go @@ -196,7 +196,6 @@ func newCall(mainOffer receivedSignal, r *activeRelay) { // I am not sure this is a strong way to determine whether we are having // a video call or not, but I have not found any better way yet... isVideoCall := strings.Contains(mainOffer.sdp.SDP, "m=video") || strings.Contains(mainOffer.sdp.SDP, "mid:video") - print(mainOffer.sdp.SDP) numberTracks := 1 if isVideoCall { numberTracks = 2 @@ -427,11 +426,14 @@ func newCall(mainOffer receivedSignal, r *activeRelay) { // First, we must make sure that we got all the tracks we need, before // creating an offer (in order not to miss a track while building the offer) - stopCheck := len(localTracks) >= numberTracks // Stop check if we got all the channel + stopCheck := len(localTracks) >= numberTracks // Stop check if we got all the channels for !stopCheck { select { case t := <-localTrackChan: localTracks = append(localTracks, t) + if len(localTracks) >= numberTracks { + stopCheck = true + } case <-time.After(time.Millisecond * 1000): stopCheck = true }