mirror of
https://github.com/bluenviron/mediamtx
synced 2025-02-21 14:06:52 +00:00
invert udp and tcp handling
This commit is contained in:
parent
efa31937c9
commit
5840b37e8c
@ -818,7 +818,27 @@ func (c *serverClient) runPlay(path string) {
|
||||
}
|
||||
}
|
||||
|
||||
if c.streamProtocol == gortsplib.StreamProtocolTcp {
|
||||
if c.streamProtocol == gortsplib.StreamProtocolUdp {
|
||||
for {
|
||||
req, err := c.conn.ReadRequest()
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
c.log("ERR: %s", err)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
ok := c.handleRequest(req)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
c.p.events <- programEventClientPlayStop{done, c}
|
||||
<-done
|
||||
|
||||
} else {
|
||||
readDone := make(chan error)
|
||||
go func() {
|
||||
buf := make([]byte, 2048)
|
||||
@ -859,26 +879,6 @@ func (c *serverClient) runPlay(path string) {
|
||||
<-done
|
||||
|
||||
close(c.events)
|
||||
|
||||
} else {
|
||||
for {
|
||||
req, err := c.conn.ReadRequest()
|
||||
if err != nil {
|
||||
if err != io.EOF {
|
||||
c.log("ERR: %s", err)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
ok := c.handleRequest(req)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
c.p.events <- programEventClientPlayStop{done, c}
|
||||
<-done
|
||||
}
|
||||
|
||||
if runOnReadCmd != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user