-
Notifications
You must be signed in to change notification settings - Fork 33
Live Stream Features (v1) #99
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
base: main
Are you sure you want to change the base?
Conversation
…and interfaces implement process lifecycle, platform capture args, and scale-to-zero integration
wire stream manager and ffmpeg streamer into api service add rtmp/rtmps config options and validation
implement start/stop/list endpoints, stream manager registration, rtmp server with rtmps tls support and ensure streams/rtmp are stopped on shutdown
…Test; refactor api tests to use unified stream setup
default request host to 127.0.0.1 on empty input and add rtmp dependency
…layback urls; add rtmp config defaults and tidy struct field formatting
Mesa DescriptionTL;DRAdded live streaming capabilities to the server, enabling session capture and broadcast both internally and to remote RTMP(S) destinations. Why we made these changesTo provide users with the ability to capture and broadcast their kernel image sessions, supporting both local internal access and broader distribution via remote streaming. What changed?
ValidationTested on local ✅ Internal streamcurl -X POST http://localhost:444/stream/start \
-H "Content-Type: application/json" \
-d '{}'{
"id": "default",
"mode": "internal",
"ingest_url": "rtmp://127.0.0.1:1935/live/default",
"playback_url": "rtmp://127.0.0.1:1935/live/default",
"secure_playback_url": "rtmps://127.0.0.1:1936/live/default",
"started_at": "2025-12-01T12:55:00Z",
"is_streaming": true
}Feed to remote streamcurl -X POST http://localhost:444/stream/start \
-H "Content-Type: application/json" \
-d '{
"id": "remote-demo",
"mode": "remote",
"target_url": "rtmps://live.cloudflare.com:443/live/streamkeyxxxxxxxxxxx"
}'{
"id": "remote-demo",
"mode": "remote",
"ingest_url": "rtmps://...",
"playback_url": "rtmps://...",
"secure_playback_url": null,
"started_at": "2025-12-01T12:57:00Z",
"is_streaming": true
}List active streamscurl http://localhost:444/stream/list[
{
"id": "default",
"mode": "internal",
"ingest_url": "rtmp://127.0.0.1:1935/live/default",
"playback_url": "rtmp://127.0.0.1:1935/live/default",
"secure_playback_url": "rtmps://127.0.0.1:1936/live/default",
"started_at": "2025-12-01T12:55:00Z",
"is_streaming": true
}
]Stop a streamTo stop a specific stream (for example, curl -X POST http://localhost:444/stream/stop \
-H "Content-Type: application/json" \
-d '{"id": "remote-demo"}'{}Description generated by Mesa. Update settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performed full review of 3dfcec2...ea0f9ba
Analysis
-
Process Management: The FFmpeg streaming component doesn't properly log errors when terminating processes (SIGINT/SIGKILL), potentially hindering debugging of failed terminations. The implementation also has platform-specific assumptions that may cause issues in cross-platform environments.
-
Race Conditions: The RTMP server has potential race conditions in its Start() method where the mutex is released before starting accept loops, and the acceptLoop checks for context cancellation after error handling, potentially generating unnecessary error logs during shutdown.
-
Silent Failure Modes: The self-signed certificate generation falls back silently with just logging, meaning RTMPS could be unavailable without clear indication. Similarly, there are "magic numbers" like the 250ms startup detection timeout that lack documentation or configurability.
-
Resource Management Gaps: When handling existing streams that aren't actively streaming, the code deregisters and continues without properly ensuring the old FFmpeg process is terminated, potentially causing resource leaks.
-
Security Limitations: The internal RTMP server lacks authentication/authorization, and the self-signed TLS certificates only include "localhost" in DNSNames, limiting RTMPS connections unnecessarily without configuration options.
Tip
Help
Slash Commands:
/review- Request a full code review/review latest- Review only changes since the last review/describe- Generate PR description. This will update the PR body or issue comment depending on your configuration/help- Get help with Mesa commands and configuration options
13 files reviewed | 0 comments | Edit Agent Settings • Read Docs
Live streaming features, to capture+broadcast the session, added to the server. Handles :
Tested on local ✅
Internal stream
{ "id": "default", "mode": "internal", "ingest_url": "rtmp://127.0.0.1:1935/live/default", "playback_url": "rtmp://127.0.0.1:1935/live/default", "secure_playback_url": "rtmps://127.0.0.1:1936/live/default", "started_at": "2025-12-01T12:55:00Z", "is_streaming": true }Feed to remote stream
{ "id": "remote-demo", "mode": "remote", "ingest_url": "rtmps://...", "playback_url": "rtmps://...", "secure_playback_url": null, "started_at": "2025-12-01T12:57:00Z", "is_streaming": true }List active streams
[ { "id": "default", "mode": "internal", "ingest_url": "rtmp://127.0.0.1:1935/live/default", "playback_url": "rtmp://127.0.0.1:1935/live/default", "secure_playback_url": "rtmps://127.0.0.1:1936/live/default", "started_at": "2025-12-01T12:55:00Z", "is_streaming": true } ]Stop a stream
To stop a specific stream (for example,
id = "remote-demo"), include theidin the body:{}Note
Introduces live streaming with an FFmpeg-based streamer, an internal RTMP/RTMPS server, and new /stream start/stop/list APIs, plus config and wiring across the server.
POST /stream/start,POST /stream/stop,GET /stream/listwith modelsStartStreamRequest,StopStreamRequest,StreamInfo(OpenAPI + generated client/server).ApiServicestreaming handlers; integratestream.Manager,FFmpegStreamerFactory, andInternalServer; include stream shutdown inShutdown.lib/stream):FFmpegStreamer(screen capture ➝ RTMP),StreamManager, andRTMPServer(RTMP/RTMPS with optional self-signed TLS); sharedParams,Metadata, and interfaces.cmd/api/main):RTMP_LISTEN_ADDR,RTMPS_LISTEN_ADDR,RTMPS_CERT_PATH,RTMPS_KEY_PATH; validation and tests updated.github.com/notedit/rtmp.Written by Cursor Bugbot for commit ea0f9ba. This will update automatically on new commits. Configure here.