Don't report EOF as error in RTMP server, update dependency

This commit is contained in:
Ingo Oppermann
2024-05-29 16:33:32 +02:00
parent d6a80c28e5
commit 609bce569b
5 changed files with 14 additions and 8 deletions

2
go.mod
View File

@@ -10,7 +10,7 @@ require (
github.com/atrox/haikunatorgo/v2 v2.0.1 github.com/atrox/haikunatorgo/v2 v2.0.1
github.com/caddyserver/certmagic v0.21.2 github.com/caddyserver/certmagic v0.21.2
github.com/datarhei/gosrt v0.6.0 github.com/datarhei/gosrt v0.6.0
github.com/datarhei/joy4 v0.0.0-20240529125512-3aeb406414d6 github.com/datarhei/joy4 v0.0.0-20240529142948-6b449f526167
github.com/go-playground/validator/v10 v10.20.0 github.com/go-playground/validator/v10 v10.20.0
github.com/gobwas/glob v0.2.3 github.com/gobwas/glob v0.2.3
github.com/golang-jwt/jwt/v5 v5.2.1 github.com/golang-jwt/jwt/v5 v5.2.1

4
go.sum
View File

@@ -30,8 +30,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lV
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/datarhei/gosrt v0.6.0 h1:HrrXAw90V78ok4WMIhX6se1aTHPCn82Sg2hj+PhdmGc= github.com/datarhei/gosrt v0.6.0 h1:HrrXAw90V78ok4WMIhX6se1aTHPCn82Sg2hj+PhdmGc=
github.com/datarhei/gosrt v0.6.0/go.mod h1:fsOWdLSHUHShHjgi/46h6wjtdQrtnSdAQFnlas8ONxs= github.com/datarhei/gosrt v0.6.0/go.mod h1:fsOWdLSHUHShHjgi/46h6wjtdQrtnSdAQFnlas8ONxs=
github.com/datarhei/joy4 v0.0.0-20240529125512-3aeb406414d6 h1:qrAUWrwNUUj8Desdima+jg4xwymQ2b7khI0fm+e4BAw= github.com/datarhei/joy4 v0.0.0-20240529142948-6b449f526167 h1:hkMdYcoj4H0TQ2rSfN5uU164+Qm27P2qN04D37ISKo0=
github.com/datarhei/joy4 v0.0.0-20240529125512-3aeb406414d6/go.mod h1:Jcw/6jZDQQmPx8A7INEkXmuEF7E9jjBbSTfVSLwmiQw= github.com/datarhei/joy4 v0.0.0-20240529142948-6b449f526167/go.mod h1:Jcw/6jZDQQmPx8A7INEkXmuEF7E9jjBbSTfVSLwmiQw=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

View File

@@ -4,7 +4,9 @@ package rtmp
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"errors"
"fmt" "fmt"
"io"
"net" "net"
"net/url" "net/url"
"path/filepath" "path/filepath"
@@ -435,8 +437,10 @@ func (s *server) handlePlay(conn *rtmp.Conn) {
// Transfer the data // Transfer the data
err := avutil.CopyFile(conn, demuxer) err := avutil.CopyFile(conn, demuxer)
if err != nil { if err != nil {
if !errors.Is(err, io.EOF) {
s.log(log.Lerror, "PLAY", "ERROR", playPath, err.Error(), client) s.log(log.Lerror, "PLAY", "ERROR", playPath, err.Error(), client)
} }
}
ch.RemoveSubscriber(id) ch.RemoveSubscriber(id)
@@ -528,8 +532,10 @@ func (s *server) handlePublish(conn *rtmp.Conn) {
// Ingest the data // Ingest the data
err := avutil.CopyPackets(ch.queue, conn) err := avutil.CopyPackets(ch.queue, conn)
if err != nil { if err != nil {
if !errors.Is(err, io.EOF) {
s.log(log.Lerror, "PUBLISH", "ERROR", playPath, err.Error(), client) s.log(log.Lerror, "PUBLISH", "ERROR", playPath, err.Error(), client)
} }
}
s.lock.Lock() s.lock.Lock()
delete(s.channels, playPath) delete(s.channels, playPath)

View File

@@ -212,9 +212,9 @@ func (s *Server) Close() {
if s.listener != nil { if s.listener != nil {
s.listener.Close() s.listener.Close()
s.listener = nil s.listener = nil
}
close(s.doneChan) close(s.doneChan)
}
} }
const ( const (

2
vendor/modules.txt vendored
View File

@@ -64,7 +64,7 @@ github.com/datarhei/gosrt/crypto
github.com/datarhei/gosrt/net github.com/datarhei/gosrt/net
github.com/datarhei/gosrt/packet github.com/datarhei/gosrt/packet
github.com/datarhei/gosrt/rand github.com/datarhei/gosrt/rand
# github.com/datarhei/joy4 v0.0.0-20240529125512-3aeb406414d6 # github.com/datarhei/joy4 v0.0.0-20240529142948-6b449f526167
## explicit; go 1.14 ## explicit; go 1.14
github.com/datarhei/joy4/av github.com/datarhei/joy4/av
github.com/datarhei/joy4/av/avutil github.com/datarhei/joy4/av/avutil