Implement PUTF_DISCARD for some more displays

This commit is contained in:
Martin Pulec
2014-10-22 16:29:13 +02:00
parent d131080184
commit 42891c5ba8
4 changed files with 14 additions and 4 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);