Skip to content

Commit 45d9420

Browse files
Egress v2 (#1454)
* egress v2 * generated protobuf * undo deprecations * generated protobuf * deprecate unused quality fields * generated protobuf * remove mcap related fields for now * generated protobuf * update psrpc handler * generated protobuf * aliOss -> aliOSS * generated protobuf * update helpers * replay only * generated protobuf --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 00010b6 commit 45d9420

13 files changed

Lines changed: 5019 additions & 2715 deletions

.github/workflows/slack-notifier.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR Slack Notifier
22

33
on:
44
pull_request:
5-
types: [review_requested, reopened, closed]
5+
types: [review_requested, reopened, closed, synchronize]
66
pull_request_review:
77
types: [submitted]
88

egress/notify_options.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ func GetEgressNotifyOptions(egressInfo *livekit.EgressInfo) []webhook.NotifyOpti
3131
var whs []*livekit.WebhookConfig
3232

3333
switch req := egressInfo.Request.(type) {
34+
case *livekit.EgressInfo_Egress:
35+
if req.Egress != nil {
36+
whs = req.Egress.Webhooks
37+
}
38+
case *livekit.EgressInfo_Replay:
39+
if req.Replay != nil {
40+
whs = req.Replay.Webhooks
41+
}
3442
case *livekit.EgressInfo_RoomComposite:
3543
if req.RoomComposite != nil {
3644
whs = req.RoomComposite.Webhooks

egress/redact.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ import (
1919
"github.com/livekit/protocol/utils"
2020
)
2121

22+
// RedactStartEgressRequest redacts secrets from a V2 StartEgressRequest.
23+
func RedactStartEgressRequest(req EgressRequest) {
24+
RedactUpload(req.GetStorage())
25+
for _, output := range req.GetOutputs() {
26+
RedactUpload(output.Storage)
27+
if stream := output.GetStream(); stream != nil {
28+
RedactStreamKeys(stream)
29+
}
30+
}
31+
}
32+
2233
func RedactUpload(req UploadRequest) {
2334
if s3 := req.GetS3(); s3 != nil {
2435
s3.AccessKey = utils.Redact(s3.AccessKey, "{access_key}")

egress/types.go

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ package egress
1717
import "github.com/livekit/protocol/livekit"
1818

1919
const (
20+
EgressTypeTemplate = "template"
21+
EgressTypeWeb = "web"
22+
EgressTypeMedia = "media"
23+
2024
EgressTypeRoomComposite = "room_composite"
21-
EgressTypeWeb = "web"
2225
EgressTypeParticipant = "participant"
2326
EgressTypeTrackComposite = "track_composite"
2427
EgressTypeTrack = "track"
@@ -55,6 +58,14 @@ type DirectOutput interface {
5558
GetWebsocketUrl() string
5659
}
5760

61+
type EgressRequest interface {
62+
GetMedia() *livekit.MediaSource
63+
GetTemplate() *livekit.TemplateSource
64+
GetWeb() *livekit.WebSource
65+
GetOutputs() []*livekit.Output
66+
GetStorage() *livekit.StorageConfig
67+
}
68+
5869
type UploadRequest interface {
5970
GetS3() *livekit.S3Upload
6071
GetGcp() *livekit.GCPUpload
@@ -63,6 +74,20 @@ type UploadRequest interface {
6374
}
6475

6576
func GetTypes(request interface{}) (string, string) {
77+
if r, ok := request.(EgressRequest); ok {
78+
var egressType string
79+
if r.GetMedia() != nil {
80+
egressType = EgressTypeMedia
81+
} else if r.GetTemplate() != nil {
82+
egressType = EgressTypeTemplate
83+
} else if r.GetWeb() != nil {
84+
egressType = EgressTypeWeb
85+
} else {
86+
egressType = Unknown
87+
}
88+
return egressType, GetOutputTypeV2(r.GetOutputs())
89+
}
90+
6691
switch req := request.(type) {
6792
case *livekit.EgressInfo_RoomComposite:
6893
return EgressTypeRoomComposite, GetOutputType(req.RoomComposite)
@@ -83,6 +108,27 @@ func GetTypes(request interface{}) (string, string) {
83108
return Unknown, Unknown
84109
}
85110

111+
func GetOutputTypeV2(outputs []*livekit.Output) string {
112+
if len(outputs) == 0 {
113+
return Unknown
114+
}
115+
if len(outputs) > 1 {
116+
return OutputTypeMultiple
117+
}
118+
switch outputs[0].Config.(type) {
119+
case *livekit.Output_File:
120+
return OutputTypeFile
121+
case *livekit.Output_Stream:
122+
return OutputTypeStream
123+
case *livekit.Output_Segments:
124+
return OutputTypeSegments
125+
case *livekit.Output_Images:
126+
return OutputTypeImages
127+
default:
128+
return Unknown
129+
}
130+
}
131+
86132
func GetOutputType(req interface{}) string {
87133
if r, ok := req.(EncodedOutput); ok {
88134
outputs := make([]string, 0)

0 commit comments

Comments
 (0)