Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Jul 16, 2023
1 parent 9816098 commit 9b84daa
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/bluenviron/gohlslib v0.2.7
github.com/bluenviron/gortsplib/v3 v3.8.1
github.com/bluenviron/mediacommon v0.5.1
github.com/datarhei/gosrt v0.5.2
github.com/fsnotify/fsnotify v1.6.0
github.com/gin-gonic/gin v1.9.1
github.com/google/uuid v1.3.0
Expand All @@ -33,6 +34,7 @@ require (
require (
github.com/aler9/writerseeker v0.0.0-20220601075008-6f0e685b9c82 // indirect
github.com/asticode/go-astikit v0.30.0 // indirect
github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflx
github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
github.com/asticode/go-astits v1.11.0 h1:GTHUXht0ZXAJXsVbsLIcyfHr1Bchi4QQwMARw2ZWAng=
github.com/asticode/go-astits v1.11.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c h1:8XZeJrs4+ZYhJeJ2aZxADI2tGADS15AzIF8MQ8XAhT4=
github.com/benburkert/openpgp v0.0.0-20160410205803-c2471f86866c/go.mod h1:x1vxHcL/9AVzuk5HOloOEPrtJY0MaalYr78afXZ+pWI=
github.com/bluenviron/gohlslib v0.2.7 h1:wV4ky3PbozwWORWd9pURktMnPIT7j/mBK3ivVljgVkk=
github.com/bluenviron/gohlslib v0.2.7/go.mod h1:x5XU60uvx91bQkRI8lrKNEltUtudR0WzaONBOhH+nzQ=
github.com/bluenviron/gortsplib/v3 v3.8.1 h1:E+B8UWFJpqRWbaVnhQwQiAjEOeJjnueFhZQxSxY9Gps=
Expand All @@ -25,6 +27,8 @@ github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583j
github.com/cloudfoundry/bytefmt v0.0.0-20211005130812-5bb3c17173e5 h1:xB7KkA98BcUdzVcwyZxb5R0FGIHxNPHgZOzkjPEY5gM=
github.com/cloudfoundry/bytefmt v0.0.0-20211005130812-5bb3c17173e5/go.mod h1:v4VVB6oBMz/c9fRY6vZrwr5xKRWOH5NPDjQZlPk0Gbs=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/datarhei/gosrt v0.5.2 h1:eagqZwEIiGPNJW0rLep3gwceObyaZ17+iKRc+l4VEpc=
github.com/datarhei/gosrt v0.5.2/go.mod h1:0308GQhAu5hxe2KYdbss901aKceSSKXnwCr8Vs++eiw=
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=
Expand Down
1 change: 0 additions & 1 deletion internal/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,6 @@ func (p *Core) closeResources(newConf *conf.Conf, calledByAPI bool) {
closeHLSManager ||
closeWebRTCManager


if newConf == nil && p.confWatcher != nil {
p.confWatcher.Close()
p.confWatcher = nil
Expand Down
49 changes: 47 additions & 2 deletions internal/core/srt_server.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,55 @@
package core

import (
"context"
"sync"

"github.com/datarhei/gosrt"
)

type srtServer struct {
ctx context.Context
ctxCancel func()
wg sync.WaitGroup
ln srt.Listener
}

func newSRTServer() (*srtServer, error) {
s := &srtServer{}
func newSRTServer(
address string,
) (*srtServer, error) {
ln, err := srt.Listen("srt", address, srt.Config{
})
if err != nil {
return nil, err
}

s := &srtServer{
ln: ln,
}

s.wg.Add(1)
go s.run()

return s, nil
}

func (s *srtServer) close() {
s.ctxCancel()
s.wg.Wait()
}

func (s *srtServer) run() {
defer s.wg.Done()

outer:
for {
select {
case <-s.ctx.Done():
break outer
}
}

s.ctxCancel()

s.ln.Close()
}

0 comments on commit 9b84daa

Please sign in to comment.