links: to avoid overrun limit amount of buffers enqueued on v4l2
This commit is contained in:
parent
d57feb0359
commit
19302b93d1
@ -11,6 +11,9 @@
|
|||||||
#define CAPTURE_TIMEOUT_US (1000*1000)
|
#define CAPTURE_TIMEOUT_US (1000*1000)
|
||||||
#define N_FDS 50
|
#define N_FDS 50
|
||||||
|
|
||||||
|
#define MAX_CAPTURED_ON_CAMERA 2
|
||||||
|
#define MAX_CAPTURED_ON_M2M 2
|
||||||
|
|
||||||
typedef struct link_pool_s
|
typedef struct link_pool_s
|
||||||
{
|
{
|
||||||
struct pollfd fds[N_FDS];
|
struct pollfd fds[N_FDS];
|
||||||
@ -119,12 +122,22 @@ static bool links_enqueue_capture_buffers(buffer_list_t *capture_list, int *time
|
|||||||
|
|
||||||
// no output, just give back capture_buf
|
// no output, just give back capture_buf
|
||||||
if (!output_list) {
|
if (!output_list) {
|
||||||
|
// limit amount of buffers enqueued by camera
|
||||||
|
if (buffer_list_count_enqueued(capture_list) >= MAX_CAPTURED_ON_CAMERA) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
buffer_consumed(capture_buf, "enqueued");
|
buffer_consumed(capture_buf, "enqueued");
|
||||||
if (capture_list->fmt.interval_us > 0)
|
if (capture_list->fmt.interval_us > 0)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// limit amount of buffers enqueued by m2m
|
||||||
|
if (buffer_list_count_enqueued(output_list) >= MAX_CAPTURED_ON_M2M) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// try to find matching output slot, ignore if not present
|
// try to find matching output slot, ignore if not present
|
||||||
if (!buffer_list_find_slot(output_list)) {
|
if (!buffer_list_find_slot(output_list)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user