From e271a0257ba595fd32d69cfe349ba6185f762974 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Wed, 15 May 2024 14:59:04 +0200 Subject: [PATCH] Update dependencies --- go.mod | 2 +- go.sum | 4 +-- .../datarhei/joy4/format/rtmp/rtmp.go | 28 +++++++++++-------- vendor/modules.txt | 2 +- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index 6260659f..f182c87d 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/atrox/haikunatorgo/v2 v2.0.1 github.com/caddyserver/certmagic v0.20.0 github.com/datarhei/gosrt v0.6.0 - github.com/datarhei/joy4 v0.0.0-20240229100136-43bcaf8ef5e7 + github.com/datarhei/joy4 v0.0.0-20240515122635-392a77dff12d github.com/go-playground/validator/v10 v10.19.0 github.com/gobwas/glob v0.2.3 github.com/golang-jwt/jwt/v5 v5.2.1 diff --git a/go.sum b/go.sum index 4ba4be4c..6792bc36 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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/joy4 v0.0.0-20240229100136-43bcaf8ef5e7 h1:MG5XQMTTDPcuvvRzc1c37QbwgDbYPhKmPFo9gSaPdBE= -github.com/datarhei/joy4 v0.0.0-20240229100136-43bcaf8ef5e7/go.mod h1:Jcw/6jZDQQmPx8A7INEkXmuEF7E9jjBbSTfVSLwmiQw= +github.com/datarhei/joy4 v0.0.0-20240515122635-392a77dff12d h1:pb2UfphyP0/aCBMRdearSQUuCCQZrzMh3R/BAff9/TY= +github.com/datarhei/joy4 v0.0.0-20240515122635-392a77dff12d/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 ebaedaf9..fd176ed8 100644 --- a/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go +++ b/vendor/github.com/datarhei/joy4/format/rtmp/rtmp.go @@ -301,6 +301,7 @@ type chunkStream struct { msgdataleft uint32 msghdrtype uint8 msgdata []byte + msgcount int } func (cs *chunkStream) Start() { @@ -1521,28 +1522,33 @@ func (conn *Conn) readChunk() (err error) { timestamp = cs.timenow if cs.msgtypeid == msgtypeidVideoMsg || cs.msgtypeid == msgtypeidAudioMsg { - if !cs.gentimenow { - if cs.prevtimenow >= cs.timenow { - cs.tscount++ - } else { - cs.tscount = 0 + if cs.msgcount < 20 { // only consider the first video and audio messages + if !cs.gentimenow { + if cs.prevtimenow >= cs.timenow { + cs.tscount++ + } else { + cs.tscount = 0 + } + + // if the previous timestamp is the same as the current for too often in a row, assume defect timestamps + if cs.tscount > 10 { + cs.gentimenow = true + } + + cs.prevtimenow = cs.timenow } - if cs.tscount > 3 { - cs.gentimenow = true - } + cs.msgcount++ } if cs.gentimenow { - timestamp = uint32((time.Since(conn.start).Milliseconds() % 0xFFFFFFFF) & 0xFFFFFFFF) + timestamp = uint32(time.Since(conn.start).Milliseconds() % 0xFFFFFFFF) } } if err = conn.handleMsg(timestamp, cs.msgsid, cs.msgtypeid, cs.msgdata); err != nil { return fmt.Errorf("handleMsg: %w", err) } - - cs.prevtimenow = cs.timenow } conn.ackn += uint32(n) diff --git a/vendor/modules.txt b/vendor/modules.txt index 66c5c6fe..7786f293 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/datarhei/gosrt/crypto github.com/datarhei/gosrt/net github.com/datarhei/gosrt/packet github.com/datarhei/gosrt/rand -# github.com/datarhei/joy4 v0.0.0-20240229100136-43bcaf8ef5e7 +# github.com/datarhei/joy4 v0.0.0-20240515122635-392a77dff12d ## explicit; go 1.14 github.com/datarhei/joy4/av github.com/datarhei/joy4/av/avutil