gst as interface. (#11)

This commit is contained in:
Miroslav Šedivý
2022-10-13 19:57:31 +02:00
committed by GitHub
parent 0badeeee36
commit 095f9fe8ee
5 changed files with 72 additions and 46 deletions

View File

@ -16,7 +16,7 @@ type BroacastManagerCtx struct {
logger zerolog.Logger
mu sync.Mutex
pipeline *gst.Pipeline
pipeline gst.Pipeline
pipelineMu sync.Mutex
pipelineFn func(url string) (string, error)

View File

@ -23,7 +23,7 @@ type ScreencastManagerCtx struct {
mu sync.Mutex
wg sync.WaitGroup
pipeline *gst.Pipeline
pipeline gst.Pipeline
pipelineStr string
pipelineMu sync.Mutex
@ -202,7 +202,7 @@ func (manager *ScreencastManagerCtx) createPipeline() error {
// get first image
select {
case image, ok := <-manager.pipeline.Sample:
case image, ok := <-manager.pipeline.Sample():
if !ok {
return errors.New("unable to get first image")
} else {
@ -220,7 +220,7 @@ func (manager *ScreencastManagerCtx) createPipeline() error {
defer manager.wg.Done()
for {
image, ok := <-pipeline.Sample
image, ok := <-pipeline.Sample()
if !ok {
manager.logger.Debug().Msg("stopped receiving images")
return

View File

@ -24,7 +24,7 @@ type StreamSinkManagerCtx struct {
wg sync.WaitGroup
codec codec.RTPCodec
pipeline *gst.Pipeline
pipeline gst.Pipeline
pipelineMu sync.Mutex
pipelineFn func() (string, error)
@ -275,7 +275,7 @@ func (manager *StreamSinkManagerCtx) createPipeline() error {
defer manager.wg.Done()
for {
sample, ok := <-pipeline.Sample
sample, ok := <-pipeline.Sample()
if !ok {
manager.logger.Debug().Msg("stopped emitting samples")
return

View File

@ -20,7 +20,7 @@ type StreamSrcManagerCtx struct {
codecPipeline map[string]string // codec -> pipeline
codec codec.RTPCodec
pipeline *gst.Pipeline
pipeline gst.Pipeline
pipelineMu sync.Mutex
pipelineStr string