Skip to content

Commit

Permalink
Make whip conditional to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
j0sh committed Mar 7, 2025
1 parent eeb2016 commit 522d9e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions server/ai_mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,21 @@ func startAIMediaServer(ctx context.Context, ls *LivepeerServer) error {
ls.HTTPMux.Handle("/image-to-text", oapiReqValidator(aiMediaServerHandle(ls, multipartDecoder[worker.GenImageToTextMultipartRequestBody], processImageToText)))
ls.HTTPMux.Handle("/text-to-speech", oapiReqValidator(aiMediaServerHandle(ls, jsonDecoder[worker.GenTextToSpeechJSONRequestBody], processTextToSpeech)))

whipServer := media.NewWHIPServer()

// This is called by the media server when the stream is ready
ls.HTTPMux.Handle("POST /live/video-to-video/{stream}/start", ls.StartLiveVideo())
ls.HTTPMux.Handle("POST /live/video-to-video/{prefix}/{stream}/start", ls.StartLiveVideo())
ls.HTTPMux.Handle("POST /live/video-to-video/{stream}/update", ls.UpdateLiveVideo())
ls.HTTPMux.Handle("POST /live/video-to-video/{stream}/whip", ls.CreateWhip(whipServer))
ls.HTTPMux.Handle("HEAD /live/video-to-video/{stream}/whip", ls.WithCode(http.StatusMethodNotAllowed))
ls.HTTPMux.Handle("OPTIONS /live/video-to-video/{stream}/whip", ls.WithCode(http.StatusNoContent))
ls.HTTPMux.Handle("/live/video-to-video/smoketest", ls.SmokeTestLiveVideo())

// Configure WHIP ingest only if an addr is specified.
// TODO use a proper cli flag
if os.Getenv("LIVE_AI_WHIP_ADDR") != "" {
whipServer := media.NewWHIPServer()
ls.HTTPMux.Handle("POST /live/video-to-video/{stream}/whip", ls.CreateWhip(whipServer))
ls.HTTPMux.Handle("HEAD /live/video-to-video/{stream}/whip", ls.WithCode(http.StatusMethodNotAllowed))
ls.HTTPMux.Handle("OPTIONS /live/video-to-video/{stream}/whip", ls.WithCode(http.StatusNoContent))
}

Check warning on line 104 in server/ai_mediaserver.go

View check run for this annotation

Codecov / codecov/patch

server/ai_mediaserver.go#L100-L104

Added lines #L100 - L104 were not covered by tests

// Stream status
ls.HTTPMux.Handle("/live/video-to-video/{streamId}/status", ls.GetLiveVideoToVideoStatus())

Expand Down

0 comments on commit 522d9e6

Please sign in to comment.