Skip to content

whip: support DELETE on the resource URL - #4007

Draft
gioelecerati wants to merge 1 commit into
masterfrom
whip-delete-resource
Draft

whip: support DELETE on the resource URL#4007
gioelecerati wants to merge 1 commit into
masterfrom
whip-delete-resource

Conversation

@gioelecerati

Copy link
Copy Markdown
Member

WIP.

The WHIP spec terminates an ingest session with DELETE on the resource URL returned in Location at create time. That was an open TODO in media/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

  • WHIPServer tracks live sessions by resource ID. The ID was already generated for the Location header and then discarded; it is now the key to the session.
  • DELETE /live/video-to-video/{stream}/whip/{resource} closes the peer connection, 404 if the resource is unknown or already gone.
  • Entries are removed when the session ends by any route — DELETE, peer disconnect, or error — so a resource is valid exactly as long as its session is. MediaState.Close is idempotent, so a DELETE racing a natural teardown is harmless.

Notes

  • PATCH/PUT for ICE restarts remain unimplemented; the TODO is narrowed rather than removed.
  • OPTIONS on 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/ffmpeg fails to compile against the local ffmpeg headers, identically on master, 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.

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.
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a87c2e81-0e7e-49c4-b520-b7acb1667a17

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added go Pull requests that update Go code AI Issues and PR related to the AI-video branch. labels Jul 29, 2026
@gioelecerati
gioelecerati requested a review from j0sh July 29, 2026 16:10
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.33333% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.51953%. Comparing base (df527c3) to head (a36f21e).

Files with missing lines Patch % Lines
server/ai_mediaserver.go 0.00000% 14 Missing ⚠️
media/whip_server.go 95.45455% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                 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     
Files with missing lines Coverage Δ
media/whip_server.go 4.65632% <95.45455%> (+4.65632%) ⬆️
server/ai_mediaserver.go 6.53527% <0.00000%> (-0.09631%) ⬇️

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

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

Files with missing lines Coverage Δ
media/whip_server.go 4.65632% <95.45455%> (+4.65632%) ⬆️
server/ai_mediaserver.go 6.53527% <0.00000%> (-0.09631%) ⬇️

... and 4 files with indirect coverage changes

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

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. go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant