Skip to content

upipe_subpic_schedule: pair buffered subpictures with their flow definition - #1274

Open
kierank wants to merge 2 commits into
Upipe:masterfrom
kierank:subpic-flow-def-pairing
Open

kierank wants to merge 2 commits into
Upipe:masterfrom
kierank:subpic-flow-def-pairing

Conversation

@kierank

@kierank kierank commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

upipe_subpic_schedule stored a new flow definition on its sub output as soon as it arrived, while the subpictures already in the schedule keep being output until their pts comes round. Subtitle pages are decoded ahead of their pts, so the on-screen page went downstream under the flow definition of the next one.

That was harmless while every subpicture of a flow had the same size, but once the pic size and padding change per subpicture (as with #1272, which crops subtitles to their visible pixels), downstream rescales the current page to the geometry of the next one for the whole decode-ahead window.

Each buffered subpicture now keeps the flow definition it was received under, and that one is stored on the output when the subpicture is output. The output helper deduplicates identical flow definitions, so flows with a constant geometry behave as before. The same commit is also part of #1242.

Checked by driving the pipe with page 1 (hsize 100) at 10 s and page 2 (hsize 200) decoded ahead for 15 s: master outputs page 1 under hsize 200 from 11 s on, this branch under hsize 100, for both DVB and teletext flows. Builds without warnings

…nition

The sub stored a new flow definition on its output the moment it arrived,
while the subpictures in its schedule keep being output long after: pages
decode ahead of their pts, so the pixels of the on-screen page went
downstream under the flow definition of the next one.  This was harmless
while all subpictures of a flow had the same dimensions, but with the pic
size and padding attributes changing per subpicture, downstream rescaled the
current page to the geometry of the next page for the whole decode-ahead
window, stretching it and putting it in the wrong place.

Pair each buffered subpicture with the flow definition it was received
under, and store that on the output when the subpicture starts being output.
The output helper deduplicates identical flow definitions, so flows with
constant dimensions behave as before.
The replacement rule was gated on teletext, so a dvb subtitle uref stayed in
the list until it outlived its duration, which is the page timeout - up to
255 seconds.  Every uref in the list whose window covers the frame's date is
output again for every frame, so the per-frame work grew with the backlog,
and once the pipeline stalled it never recovered: a repeated frame carries
the same date, so nothing ever elapsed, while decoded pages kept arriving.

A dvb subtitle display set carries the whole page, exactly like a teletext
page, so the next subpicture replaces the previous one there too.  Apply the
replacement rule unconditionally, which bounds the list to the active
subpicture plus whatever is still in advance.

With each subpicture output under its own flow definition, overlapping
subpictures also made the flow definition stored on the output switch
back and forth on every frame.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant