mirror of
https://github.com/aler9/gortsplib
synced 2025-10-04 14:52:46 +08:00
client: when reading UDP streams, write reports to right IP (#818)
source IPs sent by the server were not taken into consideration. This fixes the issue.
This commit is contained in:
14
client.go
14
client.go
@@ -1556,11 +1556,11 @@ func (c *Client) doSetup(
|
|||||||
return nil, liberrors.ErrClientServerPortsNotProvided{}
|
return nil, liberrors.ErrClientServerPortsNotProvided{}
|
||||||
}
|
}
|
||||||
|
|
||||||
var readIP net.IP
|
var remoteIP net.IP
|
||||||
if thRes.Source != nil {
|
if thRes.Source != nil {
|
||||||
readIP = *thRes.Source
|
remoteIP = *thRes.Source
|
||||||
} else {
|
} else {
|
||||||
readIP = c.nconn.RemoteAddr().(*net.TCPAddr).IP
|
remoteIP = c.nconn.RemoteAddr().(*net.TCPAddr).IP
|
||||||
}
|
}
|
||||||
|
|
||||||
if serverPortsValid {
|
if serverPortsValid {
|
||||||
@@ -1568,24 +1568,24 @@ func (c *Client) doSetup(
|
|||||||
cm.udpRTPListener.readPort = thRes.ServerPorts[0]
|
cm.udpRTPListener.readPort = thRes.ServerPorts[0]
|
||||||
}
|
}
|
||||||
cm.udpRTPListener.writeAddr = &net.UDPAddr{
|
cm.udpRTPListener.writeAddr = &net.UDPAddr{
|
||||||
IP: c.nconn.RemoteAddr().(*net.TCPAddr).IP,
|
IP: remoteIP,
|
||||||
Zone: c.nconn.RemoteAddr().(*net.TCPAddr).Zone,
|
Zone: c.nconn.RemoteAddr().(*net.TCPAddr).Zone,
|
||||||
Port: thRes.ServerPorts[0],
|
Port: thRes.ServerPorts[0],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cm.udpRTPListener.readIP = readIP
|
cm.udpRTPListener.readIP = remoteIP
|
||||||
|
|
||||||
if serverPortsValid {
|
if serverPortsValid {
|
||||||
if !c.AnyPortEnable {
|
if !c.AnyPortEnable {
|
||||||
cm.udpRTCPListener.readPort = thRes.ServerPorts[1]
|
cm.udpRTCPListener.readPort = thRes.ServerPorts[1]
|
||||||
}
|
}
|
||||||
cm.udpRTCPListener.writeAddr = &net.UDPAddr{
|
cm.udpRTCPListener.writeAddr = &net.UDPAddr{
|
||||||
IP: c.nconn.RemoteAddr().(*net.TCPAddr).IP,
|
IP: remoteIP,
|
||||||
Zone: c.nconn.RemoteAddr().(*net.TCPAddr).Zone,
|
Zone: c.nconn.RemoteAddr().(*net.TCPAddr).Zone,
|
||||||
Port: thRes.ServerPorts[1],
|
Port: thRes.ServerPorts[1],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cm.udpRTCPListener.readIP = readIP
|
cm.udpRTCPListener.readIP = remoteIP
|
||||||
|
|
||||||
case TransportUDPMulticast:
|
case TransportUDPMulticast:
|
||||||
if thRes.Delivery == nil || *thRes.Delivery != headers.TransportDeliveryMulticast {
|
if thRes.Delivery == nil || *thRes.Delivery != headers.TransportDeliveryMulticast {
|
||||||
|
Reference in New Issue
Block a user