From a47366bfcf059f264abcffb4f0fba9052a8e4701 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Mon, 30 Sep 2024 16:13:24 -0700 Subject: [PATCH] remove audio with image-only egress --- pkg/config/output.go | 49 ++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/pkg/config/output.go b/pkg/config/output.go index 814f3c47..01053523 100644 --- a/pkg/config/output.go +++ b/pkg/config/output.go @@ -183,9 +183,31 @@ func (p *PipelineConfig) updateEncodedOutputs(req egress.EncodedOutput) error { p.KeyFrameInterval = StreamKeyframeInterval } - err := p.updateImageOutputs(images) - if err != nil { - return err + // image output + if len(images) > 0 { + if !p.VideoEnabled { + return errors.ErrInvalidInput("audio_only images") + } + + if len(p.Outputs) == 0 { + // enforce video only + p.AudioEnabled = false + p.AudioTrackID = "" + p.AudioTranscoding = false + } + + for _, img := range images { + conf, err := p.getImageConfig(img) + if err != nil { + return err + } + + p.Outputs[types.EgressTypeImages] = append(p.Outputs[types.EgressTypeImages], conf) + p.OutputCount.Inc() + p.FinalizationRequired = true + + p.Info.ImageResults = append(p.Info.ImageResults, conf.ImagesInfo) + } } if p.OutputCount.Load() == 0 { @@ -234,24 +256,3 @@ func (p *PipelineConfig) updateDirectOutput(req *livekit.TrackEgressRequest) err return nil } - -func (p *PipelineConfig) updateImageOutputs(images []*livekit.ImageOutput) error { - if len(images) > 0 && !p.VideoEnabled { - return errors.ErrInvalidInput("audio_only") - } - - for _, img := range images { - conf, err := p.getImageConfig(img) - if err != nil { - return err - } - - p.Outputs[types.EgressTypeImages] = append(p.Outputs[types.EgressTypeImages], conf) - p.OutputCount.Inc() - p.FinalizationRequired = true - - p.Info.ImageResults = append(p.Info.ImageResults, conf.ImagesInfo) - } - - return nil -}