client: fix reading with multicast

This commit is contained in:
aler9
2021-06-19 21:13:08 +02:00
parent 47637e3ea2
commit aeaa200638

View File

@@ -448,7 +448,7 @@ func (cc *ClientConn) runBackground() {
return cc.runBackgroundPlayTCP()
}
if *cc.protocol == ClientProtocolUDP || *cc.protocol == ClientProtocolMulticast {
if *cc.protocol == ClientProtocolUDP {
return cc.runBackgroundRecordUDP()
}
return cc.runBackgroundRecordTCP()
@@ -1636,13 +1636,14 @@ func (cc *ClientConn) WriteFrame(trackID int, streamType StreamType, payload []b
cc.tracks[trackID].rtcpSender.ProcessFrame(now, streamType, payload)
}
if *cc.protocol == ClientProtocolUDP {
switch *cc.protocol {
case ClientProtocolUDP, ClientProtocolMulticast:
if streamType == StreamTypeRTP {
return cc.tracks[trackID].udpRTPListener.write(payload)
}
return cc.tracks[trackID].udpRTCPListener.write(payload)
}
default: // TCP
cc.tcpWriteMutex.Lock()
defer cc.tcpWriteMutex.Unlock()
@@ -1653,3 +1654,4 @@ func (cc *ClientConn) WriteFrame(trackID int, streamType StreamType, payload []b
Payload: payload,
}.Write(cc.bw)
}
}