OverlayWatermarkFilter.Position had no arm for MiddleCenter, so it fell through the _ => default and rendered bottom-right. BottomRight was served by that same default, which is why the gap was invisible — both values produced identical output.
What changed
Explicit arms for all 9 WatermarkLocation values, including MiddleCenter → x=(W-w)/2:y=(H-h)/2, and BottomRight promoted out of the default.
The default arm logs a warning and falls back to bottom-right rather than throwing. Verified against every sibling filter in ErsatzTV.FFmpeg/Filter/ — all of them fall back to a safe default (string.Empty, "hwupload", None) rather than throwing, and this runs on the playback hot path where an exception would kill a stream.
Tests asserting the exact rendered filter string for every location across the software, CUDA and QSV paths.
OverlayWatermarkCudaFilter and OverlayWatermarkQsvFilter inherit Position and override only Filter/NextState, so the one base switch covers all three overlay paths — there was nothing extra to patch in the accelerated files. A grep of the whole ErsatzTV.FFmpeg project confirms exactly one WatermarkLocation switch.
Worth knowing for future enum-exhaustiveness audits: there is a secondWatermarkLocation switch outside this project, ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsElement.cs (CalculatePosition, the SkiaSharp renderer from #67). It already has a correct MiddleCenter arm and was never affected — note it applies the margin as an offset even when centered, unlike the ffmpeg path's pure center. Deliberate difference between the two renderers, not a bug.
Review
Cold review-only pass, verdict MERGEABLE. A different model family was preferred per process.independent-review-rubric, but the Codex CLI is not installed in this environment, so the rubric's stated fallback (a fresh agent with no implementation role) was used — recording the exemption rather than leaving it silent.
It confirmed all 9 position expressions against ffmpeg overlay semantics and the inheritance claim, and surfaced two gaps, both fixed in the follow-up commit:
ExpectedPositions was a hardcoded 9-element table, so a future 10th enum member would have passed every test and silently rendered bottom-right — reintroducing this exact bug. Now asserted against Enum.GetValues<WatermarkLocation>(). Negative control proven: removing MiddleCenter from the table fails the guard with the intended diagnostic.
SourceContentMargins() was exercised by no test at all. Now covered with a pillarboxed 1440x1080-in-1920x1080 case.
The original switch was already a switch expression with a catch-all _ =>, so the compiler's unhandled-enum diagnostic was never active here. This PR doesn't regress that, but it also can't rely on it — which is why the "no silent absorption" requirement is closed by a test rather than by the compiler.
Verification
ErsatzTV.FFmpeg.Tests: 64 passed, 0 failed (34 before). BOM check clean, dotnet format whitespace --folder clean. Rebased on origin/main and re-run green.
No live-E2E: this is a pure ffmpeg-argument-construction leaf with no API write path, no server state, and no UI. Per release.live-e2e-required, live-E2E is not required — stating it explicitly rather than omitting it.
fixes #503
`OverlayWatermarkFilter.Position` had no arm for `MiddleCenter`, so it fell through the `_ =>` default and rendered bottom-right. `BottomRight` was served by that same default, which is why the gap was invisible — both values produced identical output.
## What changed
- Explicit arms for all 9 `WatermarkLocation` values, including `MiddleCenter` → `x=(W-w)/2:y=(H-h)/2`, and `BottomRight` promoted out of the default.
- The `default` arm logs a warning and falls back to bottom-right rather than throwing. Verified against every sibling filter in `ErsatzTV.FFmpeg/Filter/` — all of them fall back to a safe default (`string.Empty`, `"hwupload"`, `None`) rather than throwing, and this runs on the playback hot path where an exception would kill a stream.
- Tests asserting the exact rendered filter string for every location across the software, CUDA and QSV paths.
**`OverlayWatermarkCudaFilter` and `OverlayWatermarkQsvFilter` inherit `Position`** and override only `Filter`/`NextState`, so the one base switch covers all three overlay paths — there was nothing extra to patch in the accelerated files. A grep of the whole `ErsatzTV.FFmpeg` project confirms exactly one `WatermarkLocation` switch.
Worth knowing for future enum-exhaustiveness audits: there is a **second** `WatermarkLocation` switch outside this project, `ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsElement.cs` (`CalculatePosition`, the SkiaSharp renderer from #67). It already has a correct `MiddleCenter` arm and was never affected — note it applies the margin as an offset even when centered, unlike the ffmpeg path's pure center. Deliberate difference between the two renderers, not a bug.
## Review
Cold review-only pass, verdict MERGEABLE. A different model family was preferred per `process.independent-review-rubric`, but the Codex CLI is not installed in this environment, so the rubric's stated fallback (a fresh agent with no implementation role) was used — recording the exemption rather than leaving it silent.
It confirmed all 9 position expressions against ffmpeg `overlay` semantics and the inheritance claim, and surfaced two gaps, both fixed in the follow-up commit:
1. `ExpectedPositions` was a hardcoded 9-element table, so a future 10th enum member would have passed every test and silently rendered bottom-right — reintroducing this exact bug. Now asserted against `Enum.GetValues<WatermarkLocation>()`. **Negative control proven**: removing `MiddleCenter` from the table fails the guard with the intended diagnostic.
2. `SourceContentMargins()` was exercised by no test at all. Now covered with a pillarboxed 1440x1080-in-1920x1080 case.
The original switch was already a switch *expression* with a catch-all `_ =>`, so the compiler's unhandled-enum diagnostic was never active here. This PR doesn't regress that, but it also can't rely on it — which is why the "no silent absorption" requirement is closed by a test rather than by the compiler.
## Verification
`ErsatzTV.FFmpeg.Tests`: **64 passed, 0 failed** (34 before). BOM check clean, `dotnet format whitespace --folder` clean. Rebased on `origin/main` and re-run green.
No live-E2E: this is a pure ffmpeg-argument-construction leaf with no API write path, no server state, and no UI. Per `release.live-e2e-required`, live-E2E is not required — stating it explicitly rather than omitting it.
OverlayWatermarkFilter.Position had no switch arm for MiddleCenter, so it
silently fell into the BottomRight default and rendered bottom-right.
OverlayWatermarkCudaFilter and OverlayWatermarkQsvFilter both inherit this
Position property without overriding it, so they were affected too (the
whole ErsatzTV.FFmpeg project has only this one WatermarkLocation switch).
- Add an explicit MiddleCenter arm: x=(W-w)/2:y=(H-h)/2
- Make BottomRight an explicit arm instead of the fallthrough default
- The default case now logs a warning (not throw - this runs on the
playback hot path constructing ffmpeg args, and sibling filters in this
project already use safe string fallbacks rather than throwing for an
unmapped enum) and falls back to the BottomRight position
- Strip the pre-existing UTF-8 BOM from OverlayWatermarkFilter.cs (#311
formatting gate: touching a legacy BOM'd file makes removing it ours)
- Add ErsatzTV.FFmpeg.Tests/Filter/OverlayWatermarkFilterTests.cs asserting
the exact position expression for every WatermarkLocation value across
the software, CUDA, and QSV overlay filters, plus the unmapped-value
fallback
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Review follow-up. The 9-element ExpectedPositions table meant a future enum
member would pass every case and silently render bottom-right again -- the
exact bug #503 fixes. Assert the table covers Enum.GetValues instead, and
exercise the previously untested SourceContentMargins() branch.
Independent cold review-only pass over the full diff. Verdict was MERGEABLE; its two findings (no enum-exhaustiveness guard, SourceContentMargins() untested) were fixed in the follow-up commit, with the exhaustiveness guard's negative control proven — removing MiddleCenter from the expected table fails it with the intended diagnostic.
Reviewer-family note for the audit trail: process.independent-review-rubric prefers a different model family than the implementer. The Codex CLI is not installed in this environment, so the rubric's stated fallback was used — a fresh agent with no implementation role, cold-briefed. Recording the exemption rather than leaving it silent.
Branch rebased onto abeef63f (clean, no conflicts) and re-verified at head: ErsatzTV.FFmpeg.Tests 64 passed, 0 failed.
Independent cold review-only pass over the full diff. Verdict was MERGEABLE; its two findings (no enum-exhaustiveness guard, `SourceContentMargins()` untested) were fixed in the follow-up commit, with the exhaustiveness guard's negative control proven — removing `MiddleCenter` from the expected table fails it with the intended diagnostic.
Reviewer-family note for the audit trail: `process.independent-review-rubric` prefers a different model family than the implementer. The Codex CLI is not installed in this environment, so the rubric's stated fallback was used — a fresh agent with no implementation role, cold-briefed. Recording the exemption rather than leaving it silent.
Branch rebased onto `abeef63f` (clean, no conflicts) and re-verified at head: `ErsatzTV.FFmpeg.Tests` 64 passed, 0 failed.
Review-verdict: MERGEABLE @ 39873811
timothy
merged commit fd70e6eb4f into main2026-07-25 16:35:28 +02:00
Correction to the reviewer-family note above, for the audit trail.
I claimed the Codex CLI was unavailable in this environment and invoked process.independent-review-rubric's fallback. That claim was wrong — one codex:codex-rescue dispatch failed early in this session with an install error and I generalized from it, but the same agent was verified working elsewhere the same day. The failure was transient or pre-install, not a property of the environment.
The exemption recorded above therefore wasn't warranted; I should have retried instead of writing the capability off after a single failed dispatch. For this particular change the practical impact is small — it is a pure ffmpeg-argument leaf, and the cold same-family pass verified all nine position expressions against overlay semantics and surfaced the enum-exhaustiveness gap that was then fixed — but the process note should not stand unchallenged in the record.
Correction to the reviewer-family note above, for the audit trail.
I claimed the Codex CLI was unavailable in this environment and invoked `process.independent-review-rubric`'s fallback. That claim was wrong — one `codex:codex-rescue` dispatch failed early in this session with an install error and I generalized from it, but the same agent was verified working elsewhere the same day. The failure was transient or pre-install, not a property of the environment.
The exemption recorded above therefore wasn't warranted; I should have retried instead of writing the capability off after a single failed dispatch. For this particular change the practical impact is small — it is a pure ffmpeg-argument leaf, and the cold same-family pass verified all nine position expressions against `overlay` semantics and surfaced the enum-exhaustiveness gap that was then fixed — but the process note should not stand unchallenged in the record.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
fixes #503
OverlayWatermarkFilter.Positionhad no arm forMiddleCenter, so it fell through the_ =>default and rendered bottom-right.BottomRightwas served by that same default, which is why the gap was invisible — both values produced identical output.What changed
WatermarkLocationvalues, includingMiddleCenter→x=(W-w)/2:y=(H-h)/2, andBottomRightpromoted out of the default.defaultarm logs a warning and falls back to bottom-right rather than throwing. Verified against every sibling filter inErsatzTV.FFmpeg/Filter/— all of them fall back to a safe default (string.Empty,"hwupload",None) rather than throwing, and this runs on the playback hot path where an exception would kill a stream.OverlayWatermarkCudaFilterandOverlayWatermarkQsvFilterinheritPositionand override onlyFilter/NextState, so the one base switch covers all three overlay paths — there was nothing extra to patch in the accelerated files. A grep of the wholeErsatzTV.FFmpegproject confirms exactly oneWatermarkLocationswitch.Worth knowing for future enum-exhaustiveness audits: there is a second
WatermarkLocationswitch outside this project,ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsElement.cs(CalculatePosition, the SkiaSharp renderer from #67). It already has a correctMiddleCenterarm and was never affected — note it applies the margin as an offset even when centered, unlike the ffmpeg path's pure center. Deliberate difference between the two renderers, not a bug.Review
Cold review-only pass, verdict MERGEABLE. A different model family was preferred per
process.independent-review-rubric, but the Codex CLI is not installed in this environment, so the rubric's stated fallback (a fresh agent with no implementation role) was used — recording the exemption rather than leaving it silent.It confirmed all 9 position expressions against ffmpeg
overlaysemantics and the inheritance claim, and surfaced two gaps, both fixed in the follow-up commit:ExpectedPositionswas a hardcoded 9-element table, so a future 10th enum member would have passed every test and silently rendered bottom-right — reintroducing this exact bug. Now asserted againstEnum.GetValues<WatermarkLocation>(). Negative control proven: removingMiddleCenterfrom the table fails the guard with the intended diagnostic.SourceContentMargins()was exercised by no test at all. Now covered with a pillarboxed 1440x1080-in-1920x1080 case.The original switch was already a switch expression with a catch-all
_ =>, so the compiler's unhandled-enum diagnostic was never active here. This PR doesn't regress that, but it also can't rely on it — which is why the "no silent absorption" requirement is closed by a test rather than by the compiler.Verification
ErsatzTV.FFmpeg.Tests: 64 passed, 0 failed (34 before). BOM check clean,dotnet format whitespace --folderclean. Rebased onorigin/mainand re-run green.No live-E2E: this is a pure ffmpeg-argument-construction leaf with no API write path, no server state, and no UI. Per
release.live-e2e-required, live-E2E is not required — stating it explicitly rather than omitting it.Independent cold review-only pass over the full diff. Verdict was MERGEABLE; its two findings (no enum-exhaustiveness guard,
SourceContentMargins()untested) were fixed in the follow-up commit, with the exhaustiveness guard's negative control proven — removingMiddleCenterfrom the expected table fails it with the intended diagnostic.Reviewer-family note for the audit trail:
process.independent-review-rubricprefers a different model family than the implementer. The Codex CLI is not installed in this environment, so the rubric's stated fallback was used — a fresh agent with no implementation role, cold-briefed. Recording the exemption rather than leaving it silent.Branch rebased onto
abeef63f(clean, no conflicts) and re-verified at head:ErsatzTV.FFmpeg.Tests64 passed, 0 failed.Review-verdict: MERGEABLE @
39873811Correction to the reviewer-family note above, for the audit trail.
I claimed the Codex CLI was unavailable in this environment and invoked
process.independent-review-rubric's fallback. That claim was wrong — onecodex:codex-rescuedispatch failed early in this session with an install error and I generalized from it, but the same agent was verified working elsewhere the same day. The failure was transient or pre-install, not a property of the environment.The exemption recorded above therefore wasn't warranted; I should have retried instead of writing the capability off after a single failed dispatch. For this particular change the practical impact is small — it is a pure ffmpeg-argument leaf, and the cold same-family pass verified all nine position expressions against
overlaysemantics and surfaced the enum-exhaustiveness gap that was then fixed — but the process note should not stand unchallenged in the record.