Browse Source

fix bias error in AAC timestamp

pull/956/head
aler9 4 years ago
parent
commit
901eae2f6b
  1. 2
      go.mod
  2. 4
      go.sum
  3. 3
      internal/core/rtmp_conn.go
  4. 2
      internal/hls/client_audio_processor.go

2
go.mod

@ -4,7 +4,7 @@ go 1.17 @@ -4,7 +4,7 @@ go 1.17
require (
code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5
github.com/aler9/gortsplib v0.0.0-20220502170135-bdbce3c370cf
github.com/aler9/gortsplib v0.0.0-20220510112518-91f6b6a6011e
github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757
github.com/fsnotify/fsnotify v1.4.9
github.com/gin-gonic/gin v1.7.2

4
go.sum

@ -4,8 +4,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo @@ -4,8 +4,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aler9/gortsplib v0.0.0-20220502170135-bdbce3c370cf h1:c6aUvheqgMpCseerpGGx0TAkAK13VkhLlk/mTwMq8hU=
github.com/aler9/gortsplib v0.0.0-20220502170135-bdbce3c370cf/go.mod h1:Mezkz7Jb5zrIWP6MxJ2uBgt5xwywZkcdmuQZ2QrFYsM=
github.com/aler9/gortsplib v0.0.0-20220510112518-91f6b6a6011e h1:3iJfQxRFjl2/EJJfTa9iRhmoNWTmUj1tJzReq3rtdWw=
github.com/aler9/gortsplib v0.0.0-20220510112518-91f6b6a6011e/go.mod h1:Mezkz7Jb5zrIWP6MxJ2uBgt5xwywZkcdmuQZ2QrFYsM=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 h1:95mXJ5fUCYpBRdSOnLAQAdJHHKxxxJrVCiaqDi965YQ=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc=
github.com/asticode/go-astikit v0.20.0 h1:+7N+J4E4lWx2QOkRdOf6DafWJMv6O4RRfgClwQokrH8=

3
internal/core/rtmp_conn.go

@ -11,6 +11,7 @@ import ( @@ -11,6 +11,7 @@ import (
"time"
"github.com/aler9/gortsplib"
"github.com/aler9/gortsplib/pkg/aac"
"github.com/aler9/gortsplib/pkg/h264"
"github.com/aler9/gortsplib/pkg/ringbuffer"
"github.com/aler9/gortsplib/pkg/rtpaac"
@ -433,7 +434,7 @@ func (c *rtmpConn) runRead(ctx context.Context) error { @@ -433,7 +434,7 @@ func (c *rtmpConn) runRead(ctx context.Context) error {
return err
}
pts += 1000 * time.Second / time.Duration(audioTrack.ClockRate())
pts += aac.SamplesPerAccessUnit * time.Second / time.Duration(audioTrack.ClockRate())
}
}
}

2
internal/hls/client_audio_processor.go

@ -93,7 +93,7 @@ func (p *clientAudioProcessor) doProcess( @@ -93,7 +93,7 @@ func (p *clientAudioProcessor) doProcess(
}
aus = append(aus, pkt.AU)
pktPts += 1000 * time.Second / time.Duration(pkt.SampleRate)
pktPts += aac.SamplesPerAccessUnit * time.Second / time.Duration(pkt.SampleRate)
}
p.onData(pts, aus)

Loading…
Cancel
Save