mirror of
https://github.com/lbgos/rift-s-linux.git
synced 2026-10-29 01:01:26 +01:00
u/sink: Make sink_queue drop the oldest frame when full
Instead of discarding the incoming frame when the queue is at capacity, drop the oldest frame possible. I can't think of a situation where it would be better to work on stale data in preference to fresh data. If there is, we can easily add a flag to choose behaviour. Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2188>
This commit is contained in:
1 parent
8b0f9e228b
commit
eb4d2cd922
1 file changed
+5
-1
@@ -99,7 +99,11 @@ static bool
|
||||
queue_try_refpush(struct u_sink_queue *q, struct xrt_frame *xf)
|
||||
{
|
||||
if (queue_is_full(q)) {
|
||||
return false;
|
||||
// Drop the oldest frame
|
||||
if (!queue_is_empty(q)) {
|
||||
struct xrt_frame *old = queue_pop(q);
|
||||
xrt_frame_reference(&old, NULL);
|
||||
}
|
||||
}
|
||||
struct u_sink_queue_elem *elem = U_TYPED_CALLOC(struct u_sink_queue_elem);
|
||||
xrt_frame_reference(&elem->frame, xf);
|
||||
|
||||
Reference in new issue
Block a user