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

new whip server #3432

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

new whip server #3432

wants to merge 4 commits into from

Conversation

j0sh
Copy link
Collaborator

@j0sh j0sh commented Mar 5, 2025

Introduces a WHIP endpoint at /live/video-to-video/{streamid}/whip

This strictly affects ingest only; it does not touch selection, trickle or anything beyond those.

There should also be no changes to the existing MediaMTX whip / rtmp ingest. The old ingest is safe to run alongside this and there should be no behavioral changes to that. The one modification is to tighten up request methods in the HTTP handler (adding POST prefixes etc) to prevent route conflicts with the new WHIP endpoints.

New Configuration Options

Currently implemented directly as environment variables.

  • LIVE_AI_WHIP_ADDR: UDP binding address for WebRTC (default: 0.0.0.0:7290)
  • LIVE_AI_NAT_IP: Public IP for NAT traversal (optional)
  • LIVE_AI_VIDEO_GATHER_TIMEOUT: Timeout for gathering video tracks (default: 5 seconds)
  • LIVE_AI_PLAYBACK_HOST: RTMP URL for output (default: rtmp://localhost/)
  • LIVE_AI_ALLOW_CORS: Enable CORS headers for browser clients (optional)

Other Changes

Added a clog.Info function for a slog-style logging API

Not Yet Implemented

  • Proper handling + documentation for the new configuration vars
  • ICE restarts + trickle ICE
  • DELETE
  • TCP, TURN, etc

These todos are all in Linear for later follow-up.

@github-actions github-actions bot added dependencies Pull requests that update a dependency file go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Mar 5, 2025
Copy link

codecov bot commented Mar 5, 2025

Codecov Report

Attention: Patch coverage is 6.12485% with 797 lines in your changes missing coverage. Please review.

Project coverage is 31.61087%. Comparing base (9a27435) to head (a620120).

Files with missing lines Patch % Lines
media/whip_server.go 0.00000% 493 Missing ⚠️
server/ai_mediaserver.go 3.31126% 145 Missing and 1 partial ⚠️
media/rtp_segmenter.go 0.00000% 129 Missing ⚠️
clog/clog.go 0.00000% 29 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 Coverage Diff                 @@
##              master       #3432         +/-   ##
===================================================
- Coverage   32.16679%   31.61087%   -0.55592%     
===================================================
  Files            147         150          +3     
  Lines          41033       41878        +845     
===================================================
+ Hits           13199       13238         +39     
- Misses         27058       27863        +805     
- Partials         776         777          +1     
Files with missing lines Coverage Δ
media/whip_connection.go 100.00000% <100.00000%> (ø)
clog/clog.go 53.76344% <0.00000%> (-9.93083%) ⬇️
media/rtp_segmenter.go 0.00000% <0.00000%> (ø)
server/ai_mediaserver.go 5.82011% <3.31126%> (-1.24065%) ⬇️
media/whip_server.go 0.00000% <0.00000%> (ø)

... and 2 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a27435...a620120. Read the comment docs.

Files with missing lines Coverage Δ
media/whip_connection.go 100.00000% <100.00000%> (ø)
clog/clog.go 53.76344% <0.00000%> (-9.93083%) ⬇️
media/rtp_segmenter.go 0.00000% <0.00000%> (ø)
server/ai_mediaserver.go 5.82011% <3.31126%> (-1.24065%) ⬇️
media/whip_server.go 0.00000% <0.00000%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@j0sh j0sh force-pushed the ja/whip-server branch from c88ed2d to 12e26d0 Compare March 7, 2025 00:19
@j0sh j0sh marked this pull request as ready for review March 7, 2025 00:45
@j0sh
Copy link
Collaborator Author

j0sh commented Mar 7, 2025

Added the ability to disable WHIP ingest entirely by omitting the LIVE_AI_WHIP_ADDR env var. This was mostly done to fix tests but may be useful if we need to disable whip for whatever reason, without a roll back. 522d9e6

Ideally we'd have a CLI argument like -whipIngest but that can come later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues and PR related to the AI-video branch. dependencies Pull requests that update a dependency file go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant