Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove audio with image-only egress #782

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}