whip: support DELETE on the resource URL - #4007
Conversation
The WHIP spec terminates an ingest session with DELETE on the resource
URL returned in Location at create time. That was an open TODO, so a
session could only end when the peer disconnected or the pipeline
errored — there was no way to stop one on request.
Track live sessions by resource ID in WHIPServer and add
DELETE /live/video-to-video/{stream}/whip/{resource}, which closes the
peer connection and returns 404 for an unknown resource. Entries are
removed when the session ends by any route, so a resource is valid
exactly as long as its session is.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4007 +/- ##
===================================================
- Coverage 35.53014% 35.51953% -0.01061%
===================================================
Files 174 174
Lines 45111 45147 +36
===================================================
+ Hits 16028 16036 +8
- Misses 27814 27837 +23
- Partials 1269 1274 +5
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
WIP.
The WHIP spec terminates an ingest session with
DELETEon the resource URL returned inLocationat create time. That was an open TODO inmedia/whip_server.go, so a session could only end when the peer disconnected or the pipeline errored — there was no way to stop one on request.Changes
WHIPServertracks live sessions by resource ID. The ID was already generated for theLocationheader and then discarded; it is now the key to the session.DELETE /live/video-to-video/{stream}/whip/{resource}closes the peer connection,404if the resource is unknown or already gone.MediaState.Closeis idempotent, so a DELETE racing a natural teardown is harmless.Notes
PATCH/PUTfor ICE restarts remain unimplemented; the TODO is narrowed rather than removed.OPTIONSon the resource path added for CORS parity with the create path.Testing
Unit tests cover deleting a known resource, an unknown one, and untracking after a session ends on its own.
go test ./media/passes.go build ./server/does not complete in my environment —lpms/ffmpegfails to compile against the local ffmpeg headers, identically onmaster, so it is unrelated to this change. The server-side handler is therefore unverified by a compiler here and wants CI before this leaves draft.