streamsrc mutex.

This commit is contained in:
Miroslav Šedivý 2022-06-25 23:53:19 +02:00
parent 527b1f08f8
commit 8e80ef2c69

View File

@ -39,6 +39,7 @@ func streamSrcNew(enabled bool, codecPipeline map[string]string, video_id string
pushedData := map[string]prometheus.Summary{} pushedData := map[string]prometheus.Summary{}
pipelinesCounter := map[string]prometheus.Counter{} pipelinesCounter := map[string]prometheus.Counter{}
pipelinesActive := map[string]prometheus.Gauge{} pipelinesActive := map[string]prometheus.Gauge{}
for codecName, pipeline := range codecPipeline { for codecName, pipeline := range codecPipeline {
codec, ok := codec.ParseStr(codecName) codec, ok := codec.ParseStr(codecName)
if !ok { if !ok {
@ -103,6 +104,9 @@ func (manager *StreamSrcManagerCtx) shutdown() {
} }
func (manager *StreamSrcManagerCtx) Codec() codec.RTPCodec { func (manager *StreamSrcManagerCtx) Codec() codec.RTPCodec {
manager.pipelineMu.Lock()
defer manager.pipelineMu.Unlock()
return manager.codec return manager.codec
} }