Skip to content

Commit

Permalink
ai/live: Send event when auth fails
Browse files Browse the repository at this point in the history
  • Loading branch information
j0sh committed Dec 19, 2024
1 parent 5a756c4 commit a75f520
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion media/rtmp2segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (ms *MediaSegmenter) RunSegmentation(ctx context.Context, in string, segmen
Muxer: ffmpeg.ComponentOptions{Name: "segment"},
}})
if err != nil {
clog.Errorf(ctx, "Failed to run segmentation. in=%s err=%s", in, err)
clog.Errorf(ctx, "Failed to run segmentation. in=%s try=%d err=%s", in, retryCount, err)

Check warning on line 62 in media/rtmp2segment.go

View check run for this annotation

Codecov / codecov/patch

media/rtmp2segment.go#L62

Added line #L62 was not covered by tests
}
retryCount++
time.Sleep(5 * time.Second)
Expand Down
2 changes: 1 addition & 1 deletion server/ai_live_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ func startEventsSubscribe(ctx context.Context, url *url.URL, params aiRequestPar
go func() {
defer StreamStatusStore.Clear(streamId)
for {
clog.Infof(ctx, "Reading from event subscription for URL: %s", url.String())
clog.V(8).Infof(ctx, "Reading from event subscription for URL: %s", url.String())

Check warning on line 256 in server/ai_live_video.go

View check run for this annotation

Codecov / codecov/patch

server/ai_live_video.go#L256

Added line #L256 was not covered by tests
segment, err := subscriber.Read()
if err != nil {
clog.Infof(ctx, "Error reading events subscription: %s", err)
Expand Down
7 changes: 6 additions & 1 deletion server/ai_mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,8 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler {
// if auth webhook returns pipeline config these will be replaced
pipeline := qp.Get("pipeline")
rawParams := qp.Get("params")
var streamID, pipelineID string
streamID := streamName
var pipelineID string

Check warning on line 434 in server/ai_mediaserver.go

View check run for this annotation

Codecov / codecov/patch

server/ai_mediaserver.go#L433-L434

Added lines #L433 - L434 were not covered by tests
var pipelineParams map[string]interface{}
if rawParams != "" {
if err := json.Unmarshal([]byte(rawParams), &pipelineParams); err != nil {
Expand All @@ -454,6 +455,10 @@ func (ls *LivepeerServer) StartLiveVideo() http.Handler {
clog.Errorf(ctx, "failed to kick input connection: %s", kickErr.Error())
}
clog.Errorf(ctx, "Live AI auth failed: %s", err.Error())
monitor.SendQueueEventAsync("ai_stream_events", map[string]string{
"type": "error",
"message": "Live AI auth failed: " + err.Error(),
})

Check warning on line 461 in server/ai_mediaserver.go

View check run for this annotation

Codecov / codecov/patch

server/ai_mediaserver.go#L458-L461

Added lines #L458 - L461 were not covered by tests
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
Expand Down

0 comments on commit a75f520

Please sign in to comment.