mirror of
https://github.com/livekit/livekit.git
synced 2026-04-29 10:25:34 +00:00
Use exported GetEgressNotifyOptions (#3604)
This commit is contained in:
@@ -23,7 +23,7 @@ require (
|
||||
github.com/jxskiss/base62 v1.1.0
|
||||
github.com/livekit/mageutil v0.0.0-20230125210925-54e8a70427c1
|
||||
github.com/livekit/mediatransportutil v0.0.0-20250310153736-45596af895b6
|
||||
github.com/livekit/protocol v1.36.2-0.20250411144640-bb0bf8c9e667
|
||||
github.com/livekit/protocol v1.36.2-0.20250411163912-b29f0a8bf560
|
||||
github.com/livekit/psrpc v0.6.1-0.20250205181828-a0beed2e4126
|
||||
github.com/mackerelio/go-osstat v0.2.5
|
||||
github.com/magefile/mage v1.15.0
|
||||
|
||||
@@ -171,8 +171,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-20250310153736-45596af895b6 h1:6ZhtnY9I9knfm3ieIPpznQSEU2rDECO8yliW/ANLQ7U=
|
||||
github.com/livekit/mediatransportutil v0.0.0-20250310153736-45596af895b6/go.mod h1:36s+wwmU3O40IAhE+MjBWP3W71QRiEE9SfooSBvtBqY=
|
||||
github.com/livekit/protocol v1.36.2-0.20250411144640-bb0bf8c9e667 h1:+AnPavdOwGI+4GEVNXb2yVlAvftj8F82i4XHURN8yFQ=
|
||||
github.com/livekit/protocol v1.36.2-0.20250411144640-bb0bf8c9e667/go.mod h1:WrT/CYRxtMNOVUjnIPm5OjWtEkmreffTeE1PRZwlRg4=
|
||||
github.com/livekit/protocol v1.36.2-0.20250411163912-b29f0a8bf560 h1:FfC/nL/CSaYjl2vHJnsi1ywr5dBkm8t76clG8vBxpL8=
|
||||
github.com/livekit/protocol v1.36.2-0.20250411163912-b29f0a8bf560/go.mod h1:WrT/CYRxtMNOVUjnIPm5OjWtEkmreffTeE1PRZwlRg4=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250205181828-a0beed2e4126 h1:fzuYpAQbCid7ySPpQWWePfQOWUrs8x6dJ0T3Wl07n+Y=
|
||||
github.com/livekit/psrpc v0.6.1-0.20250205181828-a0beed2e4126/go.mod h1:X5WtEZ7OnEs72Fi5/J+i0on3964F1aynQpCalcgMqRo=
|
||||
github.com/mackerelio/go-osstat v0.2.5 h1:+MqTbZUhoIt4m8qzkVoXUJg1EuifwlAJSk4Yl2GXh+o=
|
||||
|
||||
+2
-42
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/sfu/mime"
|
||||
"github.com/livekit/livekit-server/pkg/telemetry/prometheus"
|
||||
"github.com/livekit/protocol/egress"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/utils/guid"
|
||||
@@ -429,7 +430,7 @@ func (t *telemetryService) TrackSubscribeRTPStats(
|
||||
}
|
||||
|
||||
func (t *telemetryService) NotifyEgressEvent(ctx context.Context, event string, info *livekit.EgressInfo) {
|
||||
opts := getEgressNotifyOptions(info)
|
||||
opts := egress.GetEgressNotifyOptions(info)
|
||||
|
||||
t.NotifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: event,
|
||||
@@ -598,44 +599,3 @@ func newIngressEvent(event livekit.AnalyticsEventType, ingress *livekit.IngressI
|
||||
Ingress: ingress,
|
||||
}
|
||||
}
|
||||
|
||||
func getEgressNotifyOptions(egressInfo *livekit.EgressInfo) []webhook.NotifyOption {
|
||||
if egressInfo == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if egressInfo.Request == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var whs []*livekit.WebhookConfig
|
||||
|
||||
switch req := egressInfo.Request.(type) {
|
||||
case *livekit.EgressInfo_RoomComposite:
|
||||
if req.RoomComposite != nil {
|
||||
whs = req.RoomComposite.Webhooks
|
||||
}
|
||||
case *livekit.EgressInfo_Web:
|
||||
if req.Web != nil {
|
||||
whs = req.Web.Webhooks
|
||||
}
|
||||
case *livekit.EgressInfo_Participant:
|
||||
if req.Participant != nil {
|
||||
whs = req.Participant.Webhooks
|
||||
}
|
||||
case *livekit.EgressInfo_TrackComposite:
|
||||
if req.TrackComposite != nil {
|
||||
whs = req.TrackComposite.Webhooks
|
||||
}
|
||||
case *livekit.EgressInfo_Track:
|
||||
if req.Track != nil {
|
||||
whs = req.Track.Webhooks
|
||||
}
|
||||
}
|
||||
|
||||
if len(whs) > 0 {
|
||||
return []webhook.NotifyOption{webhook.WithExtraWebhooks(whs)}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user