Repository navigation
feat(liveion): fail fast when recording an unsupported video codec - #531
Merged
Merged
Conversation
is_supported_video_codec has accepted AV1 for a while, and the start record handler falls back to the session start timestamp when the output path has no 10-digit segment, so record_id is never empty. Closes #528
Starting a recording on a stream whose video codec the recorder cannot write (e.g. VP8) used to return 200 and silently drop every video packet, only surfacing as a Failed session at stop time. The codec is known inside RecordingTask::spawn before it returns, so reject the start right there with a typed UnsupportedVideoCodec error that the route maps to 400 — a clearly labeled failure beats a silently video-less recording (live777#524). Late-arriving video tracks (audio broke the wait loop first) still only log at runtime; covering that needs a mid-recording abort policy and is left for a follow-up. Add tests/recorder.rs (VP8 start -> 400 naming the codec, H264 start -> 200 + clean stop) and wire the new binary into the nextest serial-integration groups. Closes #524
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 15 files with indirect coverage changes 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Recording a stream whose video codec the recorder cannot write (VP8) returned
200 OK, logged a warning, silently dropped every video packet at runtime, and only surfaced as aFailed(or audio-only) session at stop time. An API consumer had no way to learn this without polling/api/recordingsafter the fact.Closes #524.
Fix
The codec is known inside
RecordingTask::spawnbefore it returns (the spawn already waits for the first media track), so reject the start right there:spawnreturns a typedrecorder::UnsupportedVideoCodecerror instead of logging and continuing.record_streammaps it to400 Bad Requestwith a message naming the codec (video codec VP8 is not supported by the recorder); other start failures keep their existing 500 mapping.Out of scope (noted for follow-up): a video track that arrives after the start returned (audio track broke the wait loop first) still only logs and skips at runtime — failing then means aborting an active recording mid-flight, which deserves its own policy discussion.
Tests
New
tests/recorder.rs(wired into the nextest serial-integration groups):test_record_start_rejects_unsupported_video_codec: in-process VP8 WHIP publish →POST /api/record/-→ 400, body names VP8.test_record_start_accepts_supported_video_codec: H264 publish → 200, thenDELETEstops cleanly.Both run against a real liveion with recorder storage in a tempdir. Docs (en/zh) now state the 400 fail-fast.