summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
Diffstat (limited to 'stream')
-rw-r--r--stream/tvi_v4l.c13
-rw-r--r--stream/tvi_v4l2.c13
2 files changed, 10 insertions, 16 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);
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 234a5ac019..a3be9e799a 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -1376,7 +1376,8 @@ static int init(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;
@@ -1385,14 +1386,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->format.fmt.pix.sizeimage;