Rename variable

This commit is contained in:
Pierre HUBERT 2020-05-03 21:04:07 +02:00
parent 65e1f87698
commit d5a0b41f71

View File

@ -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 // 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... // 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") isVideoCall := strings.Contains(mainOffer.sdp.SDP, "m=video") || strings.Contains(mainOffer.sdp.SDP, "mid:video")
numberTracks := 1 numberExpectedTracks := 1
if isVideoCall { 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 // Ice candidates mutex
var candidatesMux sync.Mutex var candidatesMux sync.Mutex
@ -288,7 +288,7 @@ func newCall(mainOffer receivedSignal, r *activeRelay) {
return 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 // Set a handler for when a new remote track starts, this just distributes all our packets
// to connected peers // 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 // 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) // 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 { for !stopCheck {
select { select {
case t := <-localTrackChan: case t := <-localTrackChan:
localTracks = append(localTracks, t) localTracks = append(localTracks, t)
stopCheck = len(localTracks) >= numberTracks stopCheck = len(localTracks) >= numberExpectedTracks
case <-time.After(time.Millisecond * 1000): case <-time.After(time.Millisecond * 1000):
stopCheck = true stopCheck = true
} }