From d5a0b41f71d94449f85debf4d0276d013c642b08 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 3 May 2020 21:04:07 +0200 Subject: [PATCH] Rename variable --- relay.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/relay.go b/relay.go index fb4ef8d..cb2ed1f 100644 --- a/relay.go +++ b/relay.go @@ -196,12 +196,12 @@ 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") - numberTracks := 1 + numberExpectedTracks := 1 if isVideoCall { - numberTracks = 2 + numberExpectedTracks = 2 } - log.Printf("Starting new call: %s / id: %d / number of tracks: %d", r.callHash, r.id, numberTracks) + log.Printf("Starting new call: %s / id: %d / number of tracks: %d", r.callHash, r.id, numberExpectedTracks) // Ice candidates mutex var candidatesMux sync.Mutex @@ -288,7 +288,7 @@ func newCall(mainOffer receivedSignal, r *activeRelay) { return } - localTrackChan := make(chan *webrtc.Track, numberTracks) + localTrackChan := make(chan *webrtc.Track, numberExpectedTracks) // Set a handler for when a new remote track starts, this just distributes all our packets // to connected peers @@ -426,12 +426,12 @@ 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 channels + stopCheck := len(localTracks) >= numberExpectedTracks // Stop check if we got all the channels for !stopCheck { select { case t := <-localTrackChan: localTracks = append(localTracks, t) - stopCheck = len(localTracks) >= numberTracks + stopCheck = len(localTracks) >= numberExpectedTracks case <-time.After(time.Millisecond * 1000): stopCheck = true }