mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-23 11:59:51 -08:00
invert udp and tcp handling
This commit is contained in:
parent
efa31937c9
commit
5840b37e8c
1 changed files with 21 additions and 21 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue