mirror of
https://github.com/m1k1o/neko.git
synced 2025-07-24 12:08:08 +02:00
remove wait timer from goroutine
This commit is contained in:
parent
79a1c41938
commit
628c6a1b77
4 changed files with 11 additions and 23 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
type StreamSinkManagerCtx struct {
|
||||
logger zerolog.Logger
|
||||
mu sync.Mutex
|
||||
sampleChannel chan types.Sample
|
||||
|
||||
codec codec.RTPCodec
|
||||
pipeline *gst.Pipeline
|
||||
|
@ -35,6 +36,7 @@ func streamSinkNew(codec codec.RTPCodec, pipelineFn func() (string, error), vide
|
|||
logger: logger,
|
||||
codec: codec,
|
||||
pipelineFn: pipelineFn,
|
||||
sampleChannel: make(chan types.Sample),
|
||||
}
|
||||
|
||||
return manager
|
||||
|
@ -139,7 +141,7 @@ func (manager *StreamSinkManagerCtx) createPipeline() error {
|
|||
Str("src", pipelineStr).
|
||||
Msgf("creating pipeline")
|
||||
|
||||
manager.pipeline, err = gst.CreatePipeline(pipelineStr)
|
||||
manager.pipeline, err = gst.CreatePipeline(pipelineStr, manager.sampleChannel)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -169,9 +171,5 @@ func (manager *StreamSinkManagerCtx) destroyPipeline() {
|
|||
}
|
||||
|
||||
func (manager *StreamSinkManagerCtx) GetSampleChannel() chan types.Sample {
|
||||
if manager.pipeline != nil {
|
||||
return manager.pipeline.Sample
|
||||
}
|
||||
|
||||
return nil
|
||||
return manager.sampleChannel
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue