Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client: prevent switching protocol when protocol is fixed to UDP #607

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,15 +971,15 @@
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

Check warning on line 979 in client.go

View check run for this annotation

Codecov / codecov/patch

client.go#L979

Added line #L979 was not covered by tests
}
}
return true
return false
}

func (c *Client) isInUDPTimeout() bool {
Expand Down Expand Up @@ -1007,10 +1007,10 @@
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
Expand Down
2 changes: 1 addition & 1 deletion client_play_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Loading