mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00: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:
parent
8b0f9e228b
commit
eb4d2cd922
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue