add media to capture config.

This commit is contained in:
Miroslav Šedivý 2021-12-09 23:22:24 +01:00
parent 21140d3dd3
commit 6b14e01415
5 changed files with 72 additions and 28 deletions

View file

@ -14,6 +14,7 @@ import (
type StreamSrcManagerCtx struct {
logger zerolog.Logger
enabled bool
codecPipeline map[string]string // codec -> pipeline
codec codec.RTPCodec
@ -22,7 +23,7 @@ type StreamSrcManagerCtx struct {
pipelineStr string
}
func streamSrcNew(codecPipeline map[string]string, video_id string) *StreamSrcManagerCtx {
func streamSrcNew(enabled bool, codecPipeline map[string]string, video_id string) *StreamSrcManagerCtx {
logger := log.With().
Str("module", "capture").
Str("submodule", "stream-src").
@ -30,6 +31,7 @@ func streamSrcNew(codecPipeline map[string]string, video_id string) *StreamSrcMa
return &StreamSrcManagerCtx{
logger: logger,
enabled: enabled,
codecPipeline: codecPipeline,
}
}
@ -52,6 +54,10 @@ func (manager *StreamSrcManagerCtx) Start(codec codec.RTPCodec) error {
return types.ErrCapturePipelineAlreadyExists
}
if !manager.enabled {
return errors.New("stream-src not enabled")
}
found := false
for codecName, pipeline := range manager.codecPipeline {
if codecName == codec.Name {