Skip to content

feat(liveion): fail fast when recording an unsupported video codec - #531

Merged
a-wing merged 2 commits into
mainfrom
fix/record-start-unsupported-codec
Nov 24, 2026
Merged

a-wing merged 2 commits into
mainfrom
fix/record-start-unsupported-codec

Conversation

@a-wing

@a-wing a-wing commented Nov 24, 2026

Copy link
Copy Markdown
Member

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 a Failed (or audio-only) session at stop time. An API consumer had no way to learn this without polling /api/recordings after the fact.

Closes #524.

Fix

The codec is known inside RecordingTask::spawn before it returns (the spawn already waits for the first media track), so reject the start right there:

  • spawn returns a typed recorder::UnsupportedVideoCodec error instead of logging and continuing.
  • record_stream maps it to 400 Bad Request with a message naming the codec (video codec VP8 is not supported by the recorder); other start failures keep their existing 500 mapping.
  • Audio-only streams are unaffected; auto-record / rotation-restart paths just log the failed start, same as any other start error.

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, then DELETE stops cleanly.

Both run against a real liveion with recorder storage in a tempdir. Docs (en/zh) now state the 400 fail-fast.

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

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
liveion/src/recorder/mod.rs 56.32% <100.00%> (+4.25%) ⬆️
liveion/src/recorder/task.rs 46.77% <100.00%> (+11.68%) ⬆️
liveion/src/route/recorder.rs 44.64% <100.00%> (+22.00%) ⬆️

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@a-wing a-wing added this to the v0.11.0 milestone Nov 24, 2026
@a-wing a-wing added enhancement New feature or request mod::live777 Live777 server labels Nov 24, 2026
@a-wing
a-wing merged commit df5af30 into main Nov 24, 2026
21 checks passed
@a-wing
a-wing deleted the fix/record-start-unsupported-codec branch November 24, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request mod::live777 Live777 server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recorder: unsupported video codec (VP8) silently degrades to an audio-only or failed recording

1 participant