diff options
Diffstat (limited to 'stream/tvi_v4l.c')
-rw-r--r-- | stream/tvi_v4l.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/stream/tvi_v4l.c b/stream/tvi_v4l.c index bbf290eeaf..31f767850b 100644 --- a/stream/tvi_v4l.c +++ b/stream/tvi_v4l.c @@ -760,7 +760,8 @@ static int uninit(priv_t *priv) static int get_capture_buffer_size(priv_t *priv) { - int bufsize, cnt; + uint64_t bufsize; + int cnt; if (priv->tv_param->buffer_size >= 0) { bufsize = priv->tv_param->buffer_size*1024*1024; @@ -769,14 +770,10 @@ static int get_capture_buffer_size(priv_t *priv) struct sysinfo si; sysinfo(&si); - if (si.totalram<2*1024*1024) { - bufsize = 1024*1024; - } else { - bufsize = si.totalram/2; - } -#else - bufsize = 16*1024*1024; + bufsize = (si.freeram/2)*si.mem_unit; + if (bufsize < 16*1024*1024) #endif + bufsize = 16*1024*1024; } cnt = bufsize/(priv->height*priv->bytesperline); |