displays: if timeout > 0, act as nonblocking

For displays not implementing timeout, take timeout > 0 as nonblocking.
This commit is contained in:
Martin Pulec
2022-10-05 11:12:58 +02:00
parent f7cc336cac
commit cfc2bdca53
10 changed files with 10 additions and 10 deletions

View File

@@ -347,7 +347,7 @@ static int display_blend_putf(void *state, struct video_frame *frame, long long
if (s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
fprintf(stderr, "blend: queue full!\n");
}
if (flags == PUTF_NONBLOCK && s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
if (flags != PUTF_BLOCKING && s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
vf_free(frame);
return 1;
}

View File

@@ -713,7 +713,7 @@ static int display_conference_putf(void *state, struct video_frame *frame, long
std::unique_lock<std::mutex> lg(s->incoming_frames_lock);
if (s->incoming_frames.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
log_msg(LOG_LEVEL_WARNING, "[conference] queue full!\n");
if(flags == PUTF_NONBLOCK){
if(flags != PUTF_BLOCKING){
vf_free(frame);
return 1;
}

View File

@@ -500,7 +500,7 @@ static int display_dvs_putf(void *state, struct video_frame *frame, long long fl
assert(s->magic == HDSP_MAGIC);
pthread_mutex_lock(&s->lock);
if(s->work_to_do && flags == PUTF_NONBLOCK) {
if(s->work_to_do && flags != PUTF_BLOCKING) {
pthread_mutex_unlock(&s->lock);
return EWOULDBLOCK;
}

View File

@@ -239,7 +239,7 @@ static int display_multiplier_putf(void *state, struct video_frame *frame, long
if (s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
fprintf(stderr, "Multiplier: queue full!\n");
}
if (flags == PUTF_NONBLOCK && s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
if (flags != PUTF_BLOCKING && s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN) {
vf_free(frame);
return 1;
}

View File

@@ -1037,7 +1037,7 @@ static int display_xrgl_putf(void *state, struct video_frame *frame, long long n
s->new_frame_ready_cv.notify_one();
return 0;
}
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK) {
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && nonblock != PUTF_BLOCKING) {
s->dispose_frame_pool.push_back(frame);
s->new_frame_ready_cv.notify_one();
return 1;

View File

@@ -283,7 +283,7 @@ static int display_panogl_putf(void *state, struct video_frame *frame, long long
}
std::unique_lock<std::mutex> lk(s->lock);
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock != PUTF_BLOCKING
&& frame != NULL) {
vf_free(frame);
printf("1 frame(s) dropped!\n");

View File

@@ -516,7 +516,7 @@ static int display_rpi4_putf(void *state, struct video_frame *frame, long long f
return 0;
}
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && flags == PUTF_NONBLOCK) {
if (s->frame_queue.size() >= MAX_BUFFER_SIZE && flags != PUTF_BLOCKING) {
log_msg(LOG_LEVEL_VERBOSE, "nonblock putf drop\n");
vf_recycle(frame);
std::lock_guard(s->free_frames_mut);

View File

@@ -632,7 +632,7 @@ static int display_sdl_putf(void *state, struct video_frame *frame, int nonblock
}
std::unique_lock<std::mutex> lk(s->lock);
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock != PUTF_BLOCKING
&& frame != NULL) {
vf_free(frame);
printf("1 frame(s) dropped!\n");

View File

@@ -714,7 +714,7 @@ static int display_sdl2_putf(void *state, struct video_frame *frame, long long n
return 0;
}
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock == PUTF_NONBLOCK
if (s->buffered_frames_count >= MAX_BUFFER_SIZE && nonblock != PUTF_BLOCKING
&& frame != NULL) {
s->free_frame_queue.push(frame);
LOG(LOG_LEVEL_INFO) << MOD_NAME << "1 frame(s) dropped!\n";

View File

@@ -254,7 +254,7 @@ static int display_unix_sock_putf(void *state, struct video_frame *frame, long l
std::unique_lock<std::mutex> lg(s->lock);
if (s->incoming_queue.size() >= IN_QUEUE_MAX_BUFFER_LEN){
if(flags == PUTF_NONBLOCK){
if(flags != PUTF_BLOCKING){
log_msg(LOG_LEVEL_WARNING, MOD_NAME "queue full!\n");
return 1;
}