[MPlayer-dev-eng] v4l/v4l2 buffer size bug

Alan Curry pacman at theworld.com
Tue Apr 25 00:21:50 CEST 2006


This code in tvi_v4l.c and tvi_v4l2.c:

        sysinfo(&si);
        if (si.totalram<2*1024*1024) {
            bufsize = 1024*1024;
        } else {
            bufsize = si.totalram/2;
        }

doesn't work correctly when si.mem_unit!=1 which will be the case whenever
any element of the sysinfo is bigger than 4G. The fix would be to substitute
si.totalram*si.mem_unit for si.totalram.

mem_unit hasn't always been there. Detecting whether the running kernel
supports mem_unit, and doing the right thing when <sys/sysinfo.h> contains
the old struct definition without mem_unit, is left as an exercise for the
v4l maintainer.




More information about the MPlayer-dev-eng mailing list