Summary - Extract proxy bootstrap implementation from bootstrap.go into internal/bootstrap/proxy.go, keeping only the Bootstrap interface in the shared file. This prepares for origin/edge servers to have their own bootstrap implementations. - Rename NewBootstrap() → NewProxyBootstrap() to follow the explicit factory naming convention. - Rebrand signature from SRSProxy to SRSX and update logger context key accordingly. - Add srs-develop skill with task router, module routing workflow, proxy unit test script, and RTMP E2E test script. - Remove st-develop skill (superseded by srs-develop). - Add srs-support eval #21 for HLS AnnexB decode error scenario. Test plan - go build ./cmd/proxy/... compiles successfully - go test ./cmd/... ./internal/... passes - E2E RTMP proxy test (proxy-e2e-test.sh) passes - Verify proxy starts and logs SRSX-Proxy/<version> started --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.7 KiB
How to Run and Test the Project
When running the project for testing or development, you should:
- Build and start the proxy server
- Start SRS origin server
- Verify SRS registration with proxy
- Publish a test stream using FFmpeg
- Verify the stream is working using ffprobe
Step 1: Build and Start Proxy Server
make && env PROXY_RTMP_SERVER=1935 PROXY_HTTP_SERVER=8080 \
PROXY_HTTP_API=1985 PROXY_WEBRTC_SERVER=8000 PROXY_SRT_SERVER=10080 \
PROXY_SYSTEM_API=12025 PROXY_LOAD_BALANCER_TYPE=memory ./srs-proxy
The proxy server should start and listen on the configured ports.
Step 2: Start SRS Origin Server
In a new terminal, start the SRS origin server. You may need to increase the file descriptor limit and use bash explicitly:
ulimit -n 10000 && bash -c "cd ~/git/srs/trunk && ./objs/srs -c conf/origin1-for-proxy.conf"
The SRS origin server should start and be ready to receive and serve streams. Check the console output for startup messages.
Step 3: Verify SRS Registration
Check the proxy logs to confirm SRS has registered itself with the proxy:
The proxy logs are printed to the console where you started the proxy server. Check the terminal running the proxy for messages indicating:
- "Register SRS media server" messages when SRS registers itself with the proxy
The SRS origin server should automatically register itself with the proxy when it starts. Look for successful registration messages in proxy console outputs.
Step 4: Publish a Test Stream
In a new terminal, publish a test stream using FFmpeg:
ffmpeg -stream_loop -1 -re -i ~/git/srs/trunk/doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
Note:
-stream_loop -1makes FFmpeg loop the input file infinitely, ensuring the stream doesn't quit after the file ends.
Step 5: Verify Stream with ffprobe
In another terminal, use ffprobe to verify the stream is working:
Test RTMP stream:
ffprobe rtmp://localhost/live/livestream
Test HTTP-FLV stream:
ffprobe http://localhost:8080/live/livestream.flv
Both commands should successfully detect the stream and display video/audio codec information. If ffprobe shows stream details without errors, the proxy is working correctly.
Code Conventions
Factory Functions
- Factory functions should use explicit interface names:
NewProxyBootstrap(),NewMemoryLoadBalancer(), etc. - Do not use generic
New()function names - This improves code clarity and makes the constructed type explicit at the call site
- Example:
// Good bs := bootstrap.NewProxyBootstrap() // Avoid bs := bootstrap.New()
Global Variables
- Avoid global variables for service instances
- This improves testability and makes code flow explicit