mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-02 08:19:14 +02:00
add media to capture config.
This commit is contained in:
parent
21140d3dd3
commit
6b14e01415
5 changed files with 72 additions and 28 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue