Skip to content

Conversation

@DawidWesierski4
Copy link
Collaborator

@DawidWesierski4 DawidWesierski4 commented Nov 18, 2025

Add: Ability to drop old frames

Change the way pipeline TX handles the order of framebuffers. Track
per-frame sequence numbers so transport can dequeue the newest converted
frame instead of always taking the next one, needed as otherwise
we cannot drop frames, as they will not be in order.

Add a new flag to the TX pipeline to enable droping frames when we jump
over epoch. Mostly will aid with user control pacing.

Implemented in a way that only drops one frame in a scenario where late
is detected. This creates limitation for extreamly high drops The stream
will still not adjust immidiately instead doing
send frame | drop frame | send frame | drop frame ...
until we catch up.
(Done mostly as big jumps over more than 2 frames could be undesirable
and if you have that big of a drop ... well this is the leas of your
troubles).

All above done in pipeline as the purpose of the api pipeline is to
smoothe the library tight timing requirements from the user
applications.

Fix the st20p wrong user timestamp reporting in frames snapped to
the next frame.

if times given by the application looks as follows
----|--frame-1--|--frame-2--|--frame-3--|--frame-4--|-...
epoch-1--|--epoch-2--|--epoch-3--|--epoch-4--|...

This causes frames to snap to the next epoch, resulting in incorrect
timestamp reporting where every frame appears to have a "wrong user
timestamp" due to the forward snapping behavior.

Fixes: 88c3566987fd6e773d07d79b67e06391f3037cb2

Add simple tests.
Fix the usdt for st40p tx (only to add the spurn event).
Fixes: 921fa0d0f21de48d385680c215365b55ca5f033d

@DawidWesierski4 DawidWesierski4 force-pushed the drop_old_frames branch 6 times, most recently from fc9cd26 to 45ae634 Compare November 19, 2025 15:20
Comment on lines 153 to 155
if (ctx->ops.notify_frame_late) {
ctx->ops.notify_frame_late(ctx->ops.priv, epoch_skipped);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be beneficial to add an option in which pipeline mode does not drop frame by itself but it calls the callback and the app handles the situation in its own way e.g. by dropping some frame or slowing down differently.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@DawidWesierski4 DawidWesierski4 force-pushed the drop_old_frames branch 3 times, most recently from db0f98d to 20c1ddd Compare November 25, 2025 13:56
@DawidWesierski4 DawidWesierski4 marked this pull request as ready for review November 25, 2025 13:56
Change the way pipeline TX handles the order of framebuffers. Track
per-frame sequence numbers so transport can dequeue the newest converted
frame instead of always taking the next one, needed as otherwise
we cannot drop frames, as they will not be in order.
(This also makes it easier for multi threaded applications to use
the api should improve performance with multiple threads from the api
only).

Add a new flag to the TX pipeline to enable droping frames when we jump
over epoch. Mostly will aid with user control pacing.

Implemented in a way that only drops one frame in a scenario where late
is detected. This creates limitation for extreamly high drops The stream
will still not adjust immidiately instead doing
send frame | drop frame | send frame | drop frame ...
until we catch up.
(Done mostly as big jumps over more than 2 frames could be undesirable
and if you have that big of a drop ... well this is the least of your
troubles).

Due to lack of consumer and producer print stats of the queue via
reporting the framebuffers statuses (removed the ACCURATE_FRAMEBUFF) as
it became redundant.

Reverts: 772621d

All above done in pipeline as the purpose of the api pipeline is to
smoothe the library tight timing requirements from the user
applications.

Fix the st20p wrong user timestamp reporting in frames snapped to
the next frame.

if times given by the application looks as follows
----|--frame-1--|--frame-2--|--frame-3--|--frame-4--|-...
epoch-1--|--epoch-2--|--epoch-3--|--epoch-4--|...

This causes frames to snap to the next epoch, resulting in incorrect
timestamp reporting where every frame appears to have a "wrong user
timestamp" due to the forward snapping behavior.

Fixes: 88c3566

Fix the usdt for st40p tx (only to add the spurn event).

Fixes: 921fa0d
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.

3 participants