Skip to content

Commit

Permalink
remove audio with image-only egress (#782)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Oct 1, 2024
1 parent 86eb9e9 commit 7853f34
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions pkg/config/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

0 comments on commit 7853f34

Please sign in to comment.