From 7853f3435c3ad337bd5dbc0eea0e006f138a7a47 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Mon, 30 Sep 2024 17:12:09 -0700 Subject: [PATCH] remove audio with image-only egress (#782) --- 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 -}