mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
client: prevent switching protocol when protocol is fixed to UDP (#607)
This commit is contained in:
10
client.go
10
client.go
@@ -971,15 +971,15 @@ func (c *Client) atLeastOneUDPPacketHasBeenReceived() bool {
|
||||
for _, ct := range c.medias {
|
||||
lft := atomic.LoadInt64(ct.udpRTPListener.lastPacketTime)
|
||||
if lft != 0 {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
|
||||
lft = atomic.LoadInt64(ct.udpRTCPListener.lastPacketTime)
|
||||
if lft != 0 {
|
||||
return false
|
||||
return true
|
||||
}
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Client) isInUDPTimeout() bool {
|
||||
@@ -1007,10 +1007,10 @@ func (c *Client) isInTCPTimeout() bool {
|
||||
func (c *Client) doCheckTimeout() error {
|
||||
if *c.effectiveTransport == TransportUDP ||
|
||||
*c.effectiveTransport == TransportUDPMulticast {
|
||||
if c.checkTimeoutInitial && !c.backChannelSetupped {
|
||||
if c.checkTimeoutInitial && !c.backChannelSetupped && c.Transport == nil {
|
||||
c.checkTimeoutInitial = false
|
||||
|
||||
if c.atLeastOneUDPPacketHasBeenReceived() {
|
||||
if !c.atLeastOneUDPPacketHasBeenReceived() {
|
||||
err := c.trySwitchingProtocol()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@@ -2278,7 +2278,7 @@ func TestClientPlayErrorTimeout(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err2)
|
||||
|
||||
if transport == "udp" || transport == "auto" {
|
||||
if transport == "auto" {
|
||||
// write a packet to skip the protocol autodetection feature
|
||||
_, err2 = l1.WriteTo(testRTPPacketMarshaled, &net.UDPAddr{
|
||||
IP: net.ParseIP("127.0.0.1"),
|
||||
|
Reference in New Issue
Block a user