Skip to content

webadmin: let owners allocate video ports, with bounded storage - #55

Merged
tridge merged 3 commits into
ArduPilot:mainfrom
tridge:pr-allow-video
Dec 1, 2026
Merged

tridge merged 3 commits into
ArduPilot:mainfrom
tridge:pr-allow-video

Conversation

@tridge

@tridge tridge commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Video ports could only be allocated by an admin. This lets any entry owner allocate their own, with bounded storage and retention by default, and fixes the field help tooltips that covered the next row of a form while you were filling it in.

Owner port allocation

  • The owner settings page has the same port count and port fields as the admin page, with free ports suggested from 40001.
  • A new port an owner picks must be 40001 or above, unused by any other entry, and not already held by another service on the host (a TCP and UDP bind probe, both when saving and when suggesting). Ports an entry already holds are kept, and admins can still pick any free port.
  • Because owners now choose the port, the HLS share-link proxy only relays a real playlist or whole 188-byte TS packets, so whatever else answers on a port is never shown to viewers.

Storage and retention defaults

  • Turning video on, or turning recording on for any slot, sets a 1 GB video budget if none was set, and 7-day retention if retention was "keep forever". Recordings share the log retention.
  • Owners can set the video budget from 1 to 4096 MB. A larger budget granted by an admin survives an owner saving the form. The keydb.py CLI does not apply these defaults.

Tooltips

  • A tip now shows only while the pointer is on the field's label (after a short delay), never while hovering or typing in an input, so it no longer covers the following field.
  • The per-slot option names (SRT, record, RTMP, ...) are clickable labels, and every slot option's help is exposed to screen readers via aria-describedby.

Form fixes

  • A save that fails validation shows what was submitted, instead of partly reverting to the stored values.
  • The 5-second auto-refresh no longer replaces a page showing validation errors.
  • A form opened before this change cannot release an entry's ports when saved.

Testing

  • New webadmin tests cover owner allocation, the video port range, collisions, host-held ports (real TCP and UDP binds), default seeding, the owner cap, failed-save behaviour and the label-only tooltips.
  • Tooltip behaviour was checked in headless Chrome: hovering an input shows nothing, hovering its label shows the tip.
  • Webadmin, keydb and video port/schema tests pass.

Known limits

  • Errors found at save time (a port collision, a budget over the cap) still redirect and lose the other edits on the form, as such errors already did.
  • Owner-chosen ports need to be open in the server's firewall.

DEFAULT_VIDEO_QUOTA_MB and seed_video_defaults() give an entry turning
video on a 1 GB budget and 7-day retention when neither is set.
suggest_video_ports() takes an avoid= callback so the web UI can skip
ports another service on the host holds.
Owners get the port count, ports and video disk budget on their own
page. A new port an owner chooses must be 40001 or above and not held
by another service on the host; ports they already hold are kept, and
admins may still choose any free port. The owner budget is capped at
4 GB, keeping a larger one an admin granted. Turning video or recording
on seeds a 1 GB budget and 7-day retention (recordings share the log
retention) if none is set.

Because owners choose the port, the HLS proxy only relays a playlist or
whole TS packets from it. A save that fails validation now re-renders
what was submitted, and auto-refresh leaves it alone while the errors
are shown.

Help tooltips now show only while the field's label is hovered. Showing
them for the whole row, or on focus, put them over the next field while
an input was being filled in. The slot option names are real labels and
the slot controls carry aria-describedby.
@tridge tridge added the AIReview Request an automated AI review; picked up by the reviewprs sweep label Dec 1, 2026
@AP-Review

Copy link
Copy Markdown

Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting.
Verdict: COMMENT

Reviewed at head 7184201d30.
Full report: https://firmware.ardupilot.org/Tools/APReview/DevCallReviews/PRReviews/ardupilot/supportproxy/55/1.html#prSupportProxy-55

This draft PR is close: port allocation, the collision checks and old-form handling look right, but turning on live video changes telemetry retention, which should be fixed.

Should fix

  • webadmin/videoform.py:182: turning on live video alone (no record slot) seeds log_retention_days from 0 (keep forever) to 7. That retention also covers tlogs and .bin files, so cleanup starts deleting telemetry the user chose to keep, and they only see "Saved.". Seed retention only when a record bit is newly set; the quota seed can stay on video-on.
Minor (2)
  • keydb_lib.py:742: seed_video_defaults treats quota 0 as unset, but the admin help says 0 means the server default. An admin's explicit 0 becomes 1024 on enable, and again when an owner later ticks record. Seed only when the field was blank, or change the help.
  • webadmin/routes_video.py:313: len % 188 == 0 rejects (503) a segment that spans a TS resync after corrupt input. The old relay served such segments and players can decode them. Check only the leading sync bytes, or reset HLS boundaries on loss of sync.

Not an issue: an owner can't lower an admin-granted budget to another value above 4 GB, which matches the documented owner cap.

@tridge
tridge marked this pull request as ready for review December 1, 2026 19:18
@tridge
tridge merged commit 72eae22 into ArduPilot:main Dec 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIReview Request an automated AI review; picked up by the reviewprs sweep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants