From 2e560b635d6bdee366300f7f59299864313fa3f0 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Wed, 14 Sep 2022 14:52:41 +0200 Subject: [PATCH] Update joy4 dependency for increase RTMP client compatibility --- go.mod | 2 +- go.sum | 4 ++-- .../datarhei/joy4/format/rtmp/rtmp.go | 20 +++++++++++++++++-- vendor/modules.txt | 2 +- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 9c9ce3ca..2dcfd42f 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/99designs/gqlgen v0.17.16 github.com/atrox/haikunatorgo/v2 v2.0.1 github.com/datarhei/gosrt v0.2.1-0.20220817080252-d44df04a3845 - github.com/datarhei/joy4 v0.0.0-20220728180719-f752080f4a36 + github.com/datarhei/joy4 v0.0.0-20220914124903-6c0f2974f0ea github.com/go-playground/validator/v10 v10.11.0 github.com/gobwas/glob v0.2.3 github.com/golang-jwt/jwt/v4 v4.4.2 diff --git a/go.sum b/go.sum index fe2d545c..d2d01fff 100644 --- a/go.sum +++ b/go.sum @@ -76,8 +76,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/datarhei/gosrt v0.2.1-0.20220817080252-d44df04a3845 h1:nlVb4EVMwdVUwH6e10WZrx4lW0n2utnlE+4ILMPyD5o= github.com/datarhei/gosrt v0.2.1-0.20220817080252-d44df04a3845/go.mod h1:wyoTu+DG45XRuCgEq/y+R8nhZCrJbOyQKn+SwNrNVZ8= -github.com/datarhei/joy4 v0.0.0-20220728180719-f752080f4a36 h1:ppjcv7wazy4d7vANREERXkSAUnhV/nfT2a+13u4ZijQ= -github.com/datarhei/joy4 v0.0.0-20220728180719-f752080f4a36/go.mod h1:Jcw/6jZDQQmPx8A7INEkXmuEF7E9jjBbSTfVSLwmiQw= +github.com/datarhei/joy4 v0.0.0-20220914124903-6c0f2974f0ea h1:qQw1AAJ1YC0HLMaTJzDxxTEYUG8dXVcx0dY0q1E1vnc= +github.com/datarhei/joy4 v0.0.0-20220914124903-6c0f2974f0ea/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.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go b/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go index 3ea6b7d9..3f0f01ac 100644 --- a/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go +++ b/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go @@ -426,8 +426,14 @@ var CodecTypes = flv.CodecTypes func (self *Conn) writeBasicConf() (err error) { // > SetChunkSize - if err = self.writeSetChunkSize(1024 * 1024 * 128); err != nil { - return + if self.isserver { + if err = self.writeSetChunkSize(self.readMaxChunkSize); err != nil { + return + } + } else { + if err = self.writeSetChunkSize(1024 * 1024 * 1); err != nil { + return + } } // > WindowAckSize if err = self.writeWindowAckSize(1024 * 1024 * 3); err != nil { @@ -471,12 +477,17 @@ func (self *Conn) readConnect() (err error) { if ok { tcurl, _ = _tcurl.(string) } + connectparams := self.commandobj if err = self.writeBasicConf(); err != nil { return } + if err = self.flushWrite(); err != nil { + return + } + // > _result("NetConnection.Connect.Success") if err = self.writeCommandMsg(3, 0, "_result", self.commandtransid, flvio.AMFMap{ @@ -1180,6 +1191,7 @@ func (self *Conn) fillChunkHeader(b []byte, csid uint32, timestamp int32, msgtyp if Debug { fmt.Printf("rtmp: write chunk msgdatalen=%d msgsid=%d\n", msgdatalen, msgsid) + fmt.Print(hex.Dump(b[:msgdatalen])) } return @@ -1568,6 +1580,10 @@ func (self *Conn) handleMsg(timestamp uint32, msgsid uint32, msgtypeid uint8, ms } self.readAckSize = pio.U32BE(self.msgdata) return + default: + if Debug { + fmt.Printf("rtmp: unhandled msg: %d\n", msgtypeid) + } } self.gotmsg = true diff --git a/vendor/modules.txt b/vendor/modules.txt index c94425b6..b59e92d0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -53,7 +53,7 @@ github.com/datarhei/gosrt/internal/congestion github.com/datarhei/gosrt/internal/crypto github.com/datarhei/gosrt/internal/net github.com/datarhei/gosrt/internal/packet -# github.com/datarhei/joy4 v0.0.0-20220728180719-f752080f4a36 +# github.com/datarhei/joy4 v0.0.0-20220914124903-6c0f2974f0ea ## explicit; go 1.14 github.com/datarhei/joy4/av github.com/datarhei/joy4/av/avutil