mirror of
https://github.com/aler9/gortsplib
synced 2025-10-23 23:23:12 +08:00
client: fix reading with multicast
This commit is contained in:
@@ -448,7 +448,7 @@ func (cc *ClientConn) runBackground() {
|
|||||||
return cc.runBackgroundPlayTCP()
|
return cc.runBackgroundPlayTCP()
|
||||||
}
|
}
|
||||||
|
|
||||||
if *cc.protocol == ClientProtocolUDP || *cc.protocol == ClientProtocolMulticast {
|
if *cc.protocol == ClientProtocolUDP {
|
||||||
return cc.runBackgroundRecordUDP()
|
return cc.runBackgroundRecordUDP()
|
||||||
}
|
}
|
||||||
return cc.runBackgroundRecordTCP()
|
return cc.runBackgroundRecordTCP()
|
||||||
@@ -1636,20 +1636,22 @@ func (cc *ClientConn) WriteFrame(trackID int, streamType StreamType, payload []b
|
|||||||
cc.tracks[trackID].rtcpSender.ProcessFrame(now, streamType, payload)
|
cc.tracks[trackID].rtcpSender.ProcessFrame(now, streamType, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *cc.protocol == ClientProtocolUDP {
|
switch *cc.protocol {
|
||||||
|
case ClientProtocolUDP, ClientProtocolMulticast:
|
||||||
if streamType == StreamTypeRTP {
|
if streamType == StreamTypeRTP {
|
||||||
return cc.tracks[trackID].udpRTPListener.write(payload)
|
return cc.tracks[trackID].udpRTPListener.write(payload)
|
||||||
}
|
}
|
||||||
return cc.tracks[trackID].udpRTCPListener.write(payload)
|
return cc.tracks[trackID].udpRTCPListener.write(payload)
|
||||||
|
|
||||||
|
default: // TCP
|
||||||
|
cc.tcpWriteMutex.Lock()
|
||||||
|
defer cc.tcpWriteMutex.Unlock()
|
||||||
|
|
||||||
|
cc.nconn.SetWriteDeadline(now.Add(cc.c.WriteTimeout))
|
||||||
|
return base.InterleavedFrame{
|
||||||
|
TrackID: trackID,
|
||||||
|
StreamType: streamType,
|
||||||
|
Payload: payload,
|
||||||
|
}.Write(cc.bw)
|
||||||
}
|
}
|
||||||
|
|
||||||
cc.tcpWriteMutex.Lock()
|
|
||||||
defer cc.tcpWriteMutex.Unlock()
|
|
||||||
|
|
||||||
cc.nconn.SetWriteDeadline(now.Add(cc.c.WriteTimeout))
|
|
||||||
return base.InterleavedFrame{
|
|
||||||
TrackID: trackID,
|
|
||||||
StreamType: streamType,
|
|
||||||
Payload: payload,
|
|
||||||
}.Write(cc.bw)
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user