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

Adopt EncodedOutput from protocol. Document Image Output in README #619

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ Irrespective of method used, when moving between protocols, containers or encodi

## Supported Output

| Egress Type | MP4 File | OGG File | WebM File | HLS (TS Segments) | RTMP(s) Stream | WebSocket Stream |
|-----------------|----------|----------|-----------|-------------------|----------------|------------------|
| Room Composite | ✅ | ✅ | | ✅ | ✅ | |
| Web | ✅ | ✅ | | ✅ | ✅ | |
| Track Composite | ✅ | ✅ | | ✅ | ✅ | |
| Track | ✅ | ✅ | ✅ | | | ✅ |
| Egress Type | MP4 File | OGG File | WebM File | HLS (TS Segments) | RTMP(s) Stream | WebSocket Stream | Thumbnails (JPEGs) |
|-----------------|----------|----------|-----------|-------------------|----------------|------------------|--------------------|
| Room Composite | ✅ | ✅ | | ✅ | ✅ | | ✅ |
| Web | ✅ | ✅ | | ✅ | ✅ | | ✅ |
| Track Composite | ✅ | ✅ | | ✅ | ✅ | | ✅ |
| Track | ✅ | ✅ | ✅ | | | ✅ | |

Files can be uploaded to any S3 compatible storage, Azure, or GCP.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/gorilla/websocket v1.5.1
github.com/livekit/livekit-server v1.5.1-0.20231026153736-8b16db227070
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
github.com/livekit/protocol v1.9.10-0.20240226133535-4a97b5832859
github.com/livekit/protocol v1.9.10-0.20240226212446-6e689b5c3569
github.com/livekit/psrpc v0.5.3-0.20240209001357-380f59f00c58
github.com/livekit/server-sdk-go/v2 v2.0.1
github.com/pion/rtp v1.8.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1 h1:jm09419p0lqTkD
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1/go.mod h1:Rs3MhFwutWhGwmY1VQsygw28z5bWcnEYmS1OG9OxjOQ=
github.com/livekit/mediatransportutil v0.0.0-20231213075826-cccbf2b93d3f h1:XHrwGwLNGQB3ZqolH1YdMH/22hgXKr4vm+2M7JKMMGg=
github.com/livekit/mediatransportutil v0.0.0-20231213075826-cccbf2b93d3f/go.mod h1:GBzn9xL+mivI1pW+tyExcKgbc0VOc29I9yJsNcAVaAc=
github.com/livekit/protocol v1.9.10-0.20240226133535-4a97b5832859 h1:RMCwDi66XgCm3vZsH8cmhBICHLH2tYIiyps/XwVpIf0=
github.com/livekit/protocol v1.9.10-0.20240226133535-4a97b5832859/go.mod h1:Ppvb/6576ksmTTHATnG+73nk65U7CxDnFVsRQ7+zAkc=
github.com/livekit/protocol v1.9.10-0.20240226212446-6e689b5c3569 h1:lVAQS1tF/NMxcmRSAgm7bE4FkAm0gSHrS2skfltZZyo=
github.com/livekit/protocol v1.9.10-0.20240226212446-6e689b5c3569/go.mod h1:Ppvb/6576ksmTTHATnG+73nk65U7CxDnFVsRQ7+zAkc=
github.com/livekit/psrpc v0.5.3-0.20240209001357-380f59f00c58 h1:yH55rBGLRO+ict2mu6bKZ5iPwTIrIwU1i0ydgThi4+k=
github.com/livekit/psrpc v0.5.3-0.20240209001357-380f59f00c58/go.mod h1:cQjxg1oCxYHhxxv6KJH1gSvdtCHQoRZCHgPdm5N8v2g=
github.com/livekit/server-sdk-go/v2 v2.0.1 h1:qwuMK7WUd30DM7IJ2sOqpQcZcHqP02tzs5Y6CRsV4Lg=
Expand Down
33 changes: 7 additions & 26 deletions pkg/config/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package config
import (
"github.com/livekit/egress/pkg/errors"
"github.com/livekit/egress/pkg/types"
"github.com/livekit/protocol/egress"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
)
Expand All @@ -33,27 +34,7 @@ func (o outputConfig) GetOutputType() types.OutputType {
return o.OutputType
}

type EncodedOutput interface {
GetFileOutputs() []*livekit.EncodedFileOutput
GetStreamOutputs() []*livekit.StreamOutput
GetSegmentOutputs() []*livekit.SegmentedFileOutput
ImageOutput
}

type EncodedOutputDeprecated interface {
GetFile() *livekit.EncodedFileOutput
GetStream() *livekit.StreamOutput
GetSegments() *livekit.SegmentedFileOutput
GetFileOutputs() []*livekit.EncodedFileOutput
GetStreamOutputs() []*livekit.StreamOutput
GetSegmentOutputs() []*livekit.SegmentedFileOutput
}

type ImageOutput interface {
GetImageOutputs() []*livekit.ImageOutput
}

func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
func (p *PipelineConfig) updateEncodedOutputs(req egress.EncodedOutput) error {
files := req.GetFileOutputs()
streams := req.GetStreamOutputs()
segments := req.GetSegmentOutputs()
Expand All @@ -63,7 +44,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
var file *livekit.EncodedFileOutput
switch len(files) {
case 0:
if r, ok := req.(EncodedOutputDeprecated); ok {
if r, ok := req.(egress.EncodedOutputDeprecated); ok {
file = r.GetFile()
}
case 1:
Expand Down Expand Up @@ -95,7 +76,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
var stream *livekit.StreamOutput
switch len(streams) {
case 0:
if r, ok := req.(EncodedOutputDeprecated); ok {
if r, ok := req.(egress.EncodedOutputDeprecated); ok {
stream = r.GetStream()
}
case 1:
Expand Down Expand Up @@ -135,7 +116,7 @@ func (p *PipelineConfig) updateEncodedOutputs(req EncodedOutput) error {
var segment *livekit.SegmentedFileOutput
switch len(segments) {
case 0:
if r, ok := req.(EncodedOutputDeprecated); ok {
if r, ok := req.(egress.EncodedOutputDeprecated); ok {
segment = r.GetSegments()
}
case 1:
Expand Down Expand Up @@ -242,7 +223,7 @@ func (p *PipelineConfig) updateImageOutputs(images []*livekit.ImageOutput) error
return nil
}

func redactEncodedOutputs(out EncodedOutput) {
func redactEncodedOutputs(out egress.EncodedOutput) {
if files := out.GetFileOutputs(); len(files) == 1 {
redactUpload(files[0])
}
Expand All @@ -252,7 +233,7 @@ func redactEncodedOutputs(out EncodedOutput) {
if segments := out.GetSegmentOutputs(); len(segments) == 1 {
redactUpload(segments[0])
}
if o, ok := out.(EncodedOutputDeprecated); ok {
if o, ok := out.(egress.EncodedOutputDeprecated); ok {
if file := o.GetFile(); file != nil {
redactUpload(file)
} else if stream := o.GetStream(); stream != nil {
Expand Down