Skip to content

test(deinterlace): allow one skipped field for a single late tick (#456) - #2904

Merged
zackees merged 2 commits into
masterfrom
test/456-deinterlace-gap-allowance
Oct 29, 2026
Merged

zackees merged 2 commits into
masterfrom
test/456-deinterlace-gap-allowance

Conversation

@zackees

@zackees zackees commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Test tolerance only, no product change. Refs #456.

What fails, measured on master

test_deinterlace_2x_field_order fails under CPU load at the gap assertion,
the same class of load sensitivity the hold assertion already allows for
("a single late tick under load (#456)").

Reproduction (Tier 2 build tree in obs-rust-linux-validate:1fe1fcb023c5615f,
LP_NUM_THREADS=1, 14 busy-loop hogs on 16 cores, load 10-23):

ctest -R '^test_deinterlace_2x_field_order_60i_into_60$' --repeat until-fail:15 -V

Two distinct cases failed this way on unpatched master:

case line message
after_pause_yadif_2x_60i_into_60 test/cmocka/test_deinterlace_2x_field_order.c:486 1 fields skipped, up to 1 in a row (allowed 0)
first_frame_linear_2x_unbuffered_60i_into_60 :486 1 fields skipped, up to 1 in a row (allowed 0)

Both runs are one skipped field (max_gap = allowed_gap + 1), with the rest of
the cadence intact: the failing after_pause_yadif_2x_60i_into_60 run reported
82 output frames, 11 unrecognised, 70 fields shown, 1 skipped, held for up to 2 frames, 0 steps back in time. On an idle host the same cases pass 60/60 fresh
processes (recorded on #456), so this is the scheduler losing a tick, not a
deterministic cadence bug.

Change

The gap assertion gains the allowance the hold assertion already has, in the
same shape and with the same limits:

  • at most one gap wider than the cadence allows in a run
    (over_gaps > 1 fails), counting only the gaps above allowed_gap, the same
    shape as the held count;
  • never two fields in a row (max_gap > allowed_gap + 1 fails).

The run's total of skipped fields is not the signal: a slower canvas drops
fields by design (50i into 30 fps dropped 27 in a case that was behaving), so
comparing skipped failed every 50i_into_30 case in CI. For a canvas slower
than the field rate (allowed_gap = 1) one two-field gap is tolerated once;
for 60i into 60 or 50i into 50 it means one single field; a second such skip,
or a wider gap, still fails. The constants move above the counting loop so the
loop no longer needs its own copy, and the file header states the rule.

Green

Patched, same selection, same loaded conditions, 16/16 repetitions passed
(100% tests passed), plus 14/14 in a run of the previous revision of the
patch. Rebuilt with ninja test_deinterlace_2x_field_order (no warnings);
clang-format --dry-run --Werror clean.

No docs/features.md line: test tooling only.

The gap assertion failed under load with `1 fields skipped, up to 1 in a
row (allowed 0)` in `after_pause_yadif_2x_60i_into_60` and
`first_frame_linear_2x_unbuffered_60i_into_60`, while every other cadence
property held (no backwards steps, holds within the existing allowance).

The hold check already tolerates one late tick. The same tick can also
cost the canvas the frame that would have shown a field, so allow one
skipped field in a run, and never two in a row: a second skip, or a wider
gap, still fails.
@zackees
zackees force-pushed the test/456-deinterlace-gap-allowance branch from 1267f7a to 9afc7e0 Compare October 29, 2026 12:01
…456)

The first cut compared the run's total skipped fields against the
allowance for one late tick. A canvas slower than the field rate drops
fields by design, so the 50i-into-30 cases failed with 27 skipped fields
at most 1 in a row, which is the cadence working as intended.

Count the skips that go past the cadence instead (gap > allowed_gap) and
allow one of them, plus one row of allowed_gap + 1. A slower canvas's
by-design drops (gap == allowed_gap) no longer count, and two late-tick
skips or a longer run still fail.
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Fixing the lane: the first cut compared the run's total skipped fields with the one-late-tick allowance, which a slower canvas trips by design (50i into 30 drops two fields in five). The 50i-into-30 cases reported 43 fields shown, 27 skipped (at most 1 in a row) and failed on the total. The assertion now counts the skips that go past the cadence (gap > allowed_gap) and allows one, so by-design drops do not count while two late-tick skips or a twice-allowance row still fail. Pushed 1e352c1.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

CI on the first cut was red for every 50i_into_30 case (13 tests, test_deinterlace_2x_field_order.c:507): 46 output frames, 43 fields shown, 27 skipped (at most 1 in a row). Those 27 skips are the slower canvas dropping fields by design, and the run-wide skipped count cannot tell them from a missed tick. 1e352c145 counts only the gaps above allowed_gap instead (over_gaps, like the held count) and allows one of them: normal cadence drops no longer count, and a second late-tick skip or a two-field row still fails. Description updated to match.

@zackees
zackees enabled auto-merge October 29, 2026 12:23
@zackees
zackees added this pull request to the merge queue Oct 29, 2026

@zackees zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: test-only tolerance, consistent with the existing hold allowance.

Checked the diff against test/cmocka/test_deinterlace_2x_field_order.c:

  • The tolerance is bounded the same way as the hold one: at most one gap wider than the cadence in the whole run (over_gaps > 1 fails) and never more than one field past it in a single gap (max_gap > allowed_gap + 1 fails). Gaps equal to allowed_gap (fields a slower canvas drops by design) are not counted, which is the right distinction and is documented in the comment.
  • Moving allowed_gap/allowed_held/expected above the counting loop is required for the over_gaps count and leaves no second definition.
  • The file header and the new comment state the rule, the measured cause (one late tick under load) and the RED evidence in the PR body (two cases at :486, 1 fields skipped, up to 1 in a row (allowed 0)), with 16/16 GREEN on the same loaded host. Consistent with #456 and the mirror-image hold tolerance already merged.
  • Test tooling only, so no docs/features.md line is required; clang-format and the Tier 2 build pass.

No changes requested. Queueing it.

Merged via the queue into master with commit afeacf4 Oct 29, 2026
38 checks passed
@zackees
zackees deleted the test/456-deinterlace-gap-allowance branch October 29, 2026 12:37
vpacher pushed a commit to wesleyhawes/obs-studio that referenced this pull request Nov 23, 2026
 obs-rust#5374) (obs-rust#5425)

* test: count deinterlace fields against ticks libobs did not render (RED, Refs obs-rust#5374)

Record, for every output frame of test_deinterlace_2x_field_order,
whether video-io repeated the frame before it (the same cache entry: a
tick the graphics thread missed), and print the repeated, lagged and
video-io dropped counts in each case's summary. The field accounting
moves into count_fields(), a pure function, with fixed-sequence cases.

RED: a 3-tick stall (the failing run of obs-rust#5374) and stall repeats are
still counted as a skip and a hold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: excuse deinterlace skips by the ticks libobs did not render (Fixes obs-rust#5374)

When the graphics thread misses N ticks, video-io repeats the last
rendered frame for them and the next render shows the field that is due
by then: up to N fields were never due at a rendered tick. The field
accounting no longer counts those repeats as holds, and excuses a skip
by up to the ticks not rendered since the field before it. With no
repeated frames the rules are unchanged, including the one late tick
allowed by obs-rust#2904; a skip or hold with no stall, or a skip past the
stall, still fails.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1795311679,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":70,"stamp":"43c71a68cbc74d9bc2f597ebff597917","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311679,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":70,"stamp":"f564239d403c85ebeea6d16bc9a6a815","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311679,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":70,"stamp":"f1e5f3da544614e3f1ef64a8de9c4822","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311679,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":70,"stamp":"03153b4f7b8976677891ef543c9004b5","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"general/all/client-lint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"96eefb001ac1163b67e3f1037b843069","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311679,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":70,"stamp":"93745534b7f53b48f77e8036035051c6","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311609,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"926bcfd66bc9e995184285db88b6f183","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311609,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"fb96360185785cccee6143bda2c7e211","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"c6eb47e9ffb7c6e8530081369f62f9d2","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"bccfd8e79336b4529e027acd8ca80140","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"55e12769df03ca97c7c64add096bc89d","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"7ec2f6772a38e8f06514cbe9757e59ff","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"1f2dc4e26d73ebbbe271be2cdfd0097e","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"0027820330180b08995f2bfe69bc9831","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"f90334cce9bf4440d90a1eca14914f95","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"ae5c8d845c407f9b16bb6bc4a2034d42","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"a8b8cdfcfc6d9f49dd976421b8c12869","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311608,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"68c72eb183c2ec14bfdfa02b1b3a3bf53f9be1dbae90d80dc91800a8e1e716c7","lane":"client-lint","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":68,"stamp":"36d51c23e007e584ccc87b6b1b236b23","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}
Ci-Attestation: {"at":1795311854,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"5be76905b23154b3363e0a67c67f84a8755c3e062e970cf2e2b374837be5332c","lane":"client-test-x86_64-unknown-linux-gnu","parents":["7c480ecb2a9718cfb9dd091cf9733861b7e4d747"],"secs":175,"stamp":"e1710cf632c31af90dbdbf1abdd60f19","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"1d9ab9704a899c04b9cd412283bda12491b55e77","coverage":"all-tracked-applicable-files","diff":["test/cmocka/test_deinterlace_2x_field_order.c"],"head":"ec16e2ff2817a8bbb8d4f16fd76b19bf03c129a2","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"73823c9dcea417b717d6234e358b9d8c555deb3e7f185755b375afa1c93bde69","tree":"fe41d69319c130c1ffc1c28b782ae6c78b169141"}}

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant