mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 08:40:19 +00:00
Implement PUTF_DISCARD for some more displays
This commit is contained in:
@@ -496,14 +496,14 @@ display_dvs_getf(void *state)
|
||||
return s->frame;
|
||||
}
|
||||
|
||||
int display_dvs_putf(void *state, struct video_frame *frame, int nonblock)
|
||||
int display_dvs_putf(void *state, struct video_frame *frame, int flags)
|
||||
{
|
||||
struct state_hdsp *s = (struct state_hdsp *)state;
|
||||
|
||||
assert(s->magic == HDSP_MAGIC);
|
||||
|
||||
pthread_mutex_lock(&s->lock);
|
||||
if(s->work_to_do && nonblock == PUTF_NONBLOCK) {
|
||||
if(s->work_to_do && flags == PUTF_NONBLOCK) {
|
||||
pthread_mutex_unlock(&s->lock);
|
||||
return EWOULDBLOCK;
|
||||
}
|
||||
|
||||
@@ -1023,6 +1023,10 @@ int display_gl_putf(void *state, struct video_frame *frame, int nonblock)
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lk(s->lock);
|
||||
if (nonblock == PUTF_DISCARD) {
|
||||
s->free_frame_queue.push(frame);
|
||||
return 0;
|
||||
}
|
||||
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK) {
|
||||
s->free_frame_queue.push(frame);
|
||||
return 1;
|
||||
|
||||
@@ -84,10 +84,11 @@ struct video_frame *display_pipe_getf(void *state)
|
||||
|
||||
int display_pipe_putf(void *state, struct video_frame *frame, int flags)
|
||||
{
|
||||
UNUSED(flags);
|
||||
struct state_pipe *s = (struct state_pipe *) state;
|
||||
|
||||
s->delegate->frame_arrived(frame);
|
||||
if (flags != PUTF_DISCARD) {
|
||||
s->delegate->frame_arrived(frame);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -558,6 +558,11 @@ int display_sdl_putf(void *state, struct video_frame *frame, int nonblock)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (nonblock == PUTF_DISCARD) {
|
||||
vf_free(frame);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lk(s->lock);
|
||||
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK) {
|
||||
vf_free(frame);
|
||||
|
||||
Reference in New Issue
Block a user