forked from External/mediamtx
update linter
This commit is contained in:
parent
3fc4ca6465
commit
0605a2f369
17 changed files with 51 additions and 27 deletions
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
|||
|
||||
- uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: v1.44.2
|
||||
version: v1.45.2
|
||||
|
||||
mod-tidy:
|
||||
runs-on: ubuntu-20.04
|
||||
|
|
|
|||
4
Makefile
4
Makefile
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
BASE_IMAGE = golang:1.17-alpine3.14
|
||||
LINT_IMAGE = golangci/golangci-lint:v1.44.2
|
||||
LINT_IMAGE = golangci/golangci-lint:v1.45.2
|
||||
NODE_IMAGE = node:14-alpine3.14
|
||||
|
||||
.PHONY: $(shell ls)
|
||||
|
|
@ -35,7 +35,7 @@ mod-tidy:
|
|||
|
||||
define DOCKERFILE_FORMAT
|
||||
FROM $(BASE_IMAGE)
|
||||
RUN go install mvdan.cc/gofumpt@v0.2.0
|
||||
RUN go install mvdan.cc/gofumpt@v0.3.1
|
||||
endef
|
||||
export DOCKERFILE_FORMAT
|
||||
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ func newHLSMuxer(
|
|||
wg *sync.WaitGroup,
|
||||
pathName string,
|
||||
pathManager hlsMuxerPathManager,
|
||||
parent hlsMuxerParent) *hlsMuxer {
|
||||
parent hlsMuxerParent,
|
||||
) *hlsMuxer {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
m := &hlsMuxer{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,8 @@ func newHLSSource(
|
|||
ur string,
|
||||
fingerprint string,
|
||||
wg *sync.WaitGroup,
|
||||
parent hlsSourceParent) *hlsSource {
|
||||
parent hlsSourceParent,
|
||||
) *hlsSource {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
s := &hlsSource{
|
||||
|
|
|
|||
|
|
@ -268,7 +268,8 @@ func newPath(
|
|||
matches []string,
|
||||
wg *sync.WaitGroup,
|
||||
externalCmdPool *externalcmd.Pool,
|
||||
parent pathParent) *path {
|
||||
parent pathParent,
|
||||
) *path {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
pa := &path{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ func newPathManager(
|
|||
pathConfs map[string]*conf.PathConf,
|
||||
externalCmdPool *externalcmd.Pool,
|
||||
metrics *metrics,
|
||||
parent pathManagerParent) *pathManager {
|
||||
parent pathManagerParent,
|
||||
) *pathManager {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
pm := &pathManager{
|
||||
|
|
@ -268,7 +269,8 @@ func (pm *pathManager) createPath(
|
|||
pathConfName string,
|
||||
pathConf *conf.PathConf,
|
||||
name string,
|
||||
matches []string) {
|
||||
matches []string,
|
||||
) {
|
||||
pm.paths[name] = newPath(
|
||||
pm.ctx,
|
||||
pm.rtspAddress,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,8 @@ func newRTMPConn(
|
|||
nconn net.Conn,
|
||||
externalCmdPool *externalcmd.Pool,
|
||||
pathManager rtmpConnPathManager,
|
||||
parent rtmpConnParent) *rtmpConn {
|
||||
parent rtmpConnParent,
|
||||
) *rtmpConn {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
c := &rtmpConn{
|
||||
|
|
@ -232,7 +233,8 @@ func (c *rtmpConn) runRead(ctx context.Context) error {
|
|||
authenticate: func(
|
||||
pathIPs []interface{},
|
||||
pathUser conf.Credential,
|
||||
pathPass conf.Credential) error {
|
||||
pathPass conf.Credential,
|
||||
) error {
|
||||
return c.authenticate(pathName, pathIPs, pathUser, pathPass, "read", query, rawQuery)
|
||||
},
|
||||
})
|
||||
|
|
@ -472,7 +474,8 @@ func (c *rtmpConn) runPublish(ctx context.Context) error {
|
|||
authenticate: func(
|
||||
pathIPs []interface{},
|
||||
pathUser conf.Credential,
|
||||
pathPass conf.Credential) error {
|
||||
pathPass conf.Credential,
|
||||
) error {
|
||||
return c.authenticate(pathName, pathIPs, pathUser, pathPass, "publish", query, rawQuery)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ func newRTMPServer(
|
|||
externalCmdPool *externalcmd.Pool,
|
||||
metrics *metrics,
|
||||
pathManager *pathManager,
|
||||
parent rtmpServerParent) (*rtmpServer, error) {
|
||||
parent rtmpServerParent,
|
||||
) (*rtmpServer, error) {
|
||||
l, err := net.Listen("tcp", address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ func newRTMPSource(
|
|||
readTimeout conf.StringDuration,
|
||||
writeTimeout conf.StringDuration,
|
||||
wg *sync.WaitGroup,
|
||||
parent rtmpSourceParent) *rtmpSource {
|
||||
parent rtmpSourceParent,
|
||||
) *rtmpSource {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
s := &rtmpSource{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ func newRTSPConn(
|
|||
externalCmdPool *externalcmd.Pool,
|
||||
pathManager *pathManager,
|
||||
conn *gortsplib.ServerConn,
|
||||
parent rtspConnParent) *rtspConn {
|
||||
parent rtspConnParent,
|
||||
) *rtspConn {
|
||||
c := &rtspConn{
|
||||
externalAuthenticationURL: externalAuthenticationURL,
|
||||
rtspAddress: rtspAddress,
|
||||
|
|
@ -248,7 +249,8 @@ func (c *rtspConn) onDescribe(ctx *gortsplib.ServerHandlerOnDescribeCtx,
|
|||
authenticate: func(
|
||||
pathIPs []interface{},
|
||||
pathUser conf.Credential,
|
||||
pathPass conf.Credential) error {
|
||||
pathPass conf.Credential,
|
||||
) error {
|
||||
return c.authenticate(ctx.Path, pathIPs, pathUser, pathPass, "read", ctx.Request, ctx.Query)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ func newRTSPServer(
|
|||
externalCmdPool *externalcmd.Pool,
|
||||
metrics *metrics,
|
||||
pathManager *pathManager,
|
||||
parent rtspServerParent) (*rtspServer, error) {
|
||||
parent rtspServerParent,
|
||||
) (*rtspServer, error) {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
s := &rtspServer{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ func newRTSPSession(
|
|||
sc *gortsplib.ServerConn,
|
||||
externalCmdPool *externalcmd.Pool,
|
||||
pathManager rtspSessionPathManager,
|
||||
parent rtspSessionParent) *rtspSession {
|
||||
parent rtspSessionParent,
|
||||
) *rtspSession {
|
||||
s := &rtspSession{
|
||||
isTLS: isTLS,
|
||||
protocols: protocols,
|
||||
|
|
@ -132,7 +133,8 @@ func (s *rtspSession) onAnnounce(c *rtspConn, ctx *gortsplib.ServerHandlerOnAnno
|
|||
authenticate: func(
|
||||
pathIPs []interface{},
|
||||
pathUser conf.Credential,
|
||||
pathPass conf.Credential) error {
|
||||
pathPass conf.Credential,
|
||||
) error {
|
||||
return c.authenticate(ctx.Path, pathIPs, pathUser, pathPass, "publish", ctx.Request, ctx.Query)
|
||||
},
|
||||
})
|
||||
|
|
@ -191,7 +193,8 @@ func (s *rtspSession) onSetup(c *rtspConn, ctx *gortsplib.ServerHandlerOnSetupCt
|
|||
authenticate: func(
|
||||
pathIPs []interface{},
|
||||
pathUser conf.Credential,
|
||||
pathPass conf.Credential) error {
|
||||
pathPass conf.Credential,
|
||||
) error {
|
||||
return c.authenticate(ctx.Path, pathIPs, pathUser, pathPass, "read", ctx.Request, ctx.Query)
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -57,7 +57,8 @@ func newRTSPSource(
|
|||
readBufferCount int,
|
||||
readBufferSize int,
|
||||
wg *sync.WaitGroup,
|
||||
parent rtspSourceParent) *rtspSource {
|
||||
parent rtspSourceParent,
|
||||
) *rtspSource {
|
||||
ctx, ctxCancel := context.WithCancel(parentCtx)
|
||||
|
||||
s := &rtspSource{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ func (p *clientAudioProcessor) run() error {
|
|||
|
||||
func (p *clientAudioProcessor) doProcess(
|
||||
data []byte,
|
||||
pts time.Duration) error {
|
||||
pts time.Duration,
|
||||
) error {
|
||||
adtsPkts, err := aac.DecodeADTS(data)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -101,7 +102,8 @@ func (p *clientAudioProcessor) doProcess(
|
|||
|
||||
func (p *clientAudioProcessor) process(
|
||||
data []byte,
|
||||
pts time.Duration) {
|
||||
pts time.Duration,
|
||||
) {
|
||||
select {
|
||||
case p.queue <- clientAudioProcessorData{data, pts}:
|
||||
case <-p.ctx.Done():
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ func (p *clientVideoProcessor) run() error {
|
|||
func (p *clientVideoProcessor) doProcess(
|
||||
data []byte,
|
||||
pts time.Duration,
|
||||
dts time.Duration) error {
|
||||
dts time.Duration,
|
||||
) error {
|
||||
elapsed := time.Since(p.clockStartRTC)
|
||||
if dts > elapsed {
|
||||
select {
|
||||
|
|
@ -142,7 +143,8 @@ func (p *clientVideoProcessor) doProcess(
|
|||
func (p *clientVideoProcessor) process(
|
||||
data []byte,
|
||||
pts time.Duration,
|
||||
dts time.Duration) {
|
||||
dts time.Duration,
|
||||
) {
|
||||
select {
|
||||
case p.queue <- clientVideoProcessorData{data, pts, dts}:
|
||||
case <-p.ctx.Done():
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ func NewMuxer(
|
|||
hlsSegmentDuration time.Duration,
|
||||
hlsSegmentMaxSize uint64,
|
||||
videoTrack *gortsplib.TrackH264,
|
||||
audioTrack *gortsplib.TrackAAC) (*Muxer, error) {
|
||||
audioTrack *gortsplib.TrackAAC,
|
||||
) (*Muxer, error) {
|
||||
if videoTrack != nil {
|
||||
if videoTrack.SPS() == nil || videoTrack.PPS() == nil {
|
||||
return nil, fmt.Errorf("invalid H264 track: SPS or PPS not provided into the SDP")
|
||||
|
|
|
|||
|
|
@ -73,7 +73,8 @@ func (t *muxerTSSegment) writeH264(
|
|||
dts time.Duration,
|
||||
pts time.Duration,
|
||||
idrPresent bool,
|
||||
enc []byte) error {
|
||||
enc []byte,
|
||||
) error {
|
||||
var af *astits.PacketAdaptationField
|
||||
|
||||
if idrPresent {
|
||||
|
|
@ -135,7 +136,8 @@ func (t *muxerTSSegment) writeAAC(
|
|||
pcr time.Duration,
|
||||
pts time.Duration,
|
||||
enc []byte,
|
||||
ausLen int) error {
|
||||
ausLen int,
|
||||
) error {
|
||||
af := &astits.PacketAdaptationField{
|
||||
RandomAccessIndicator: true,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue