Re: buggy v4l apps (was: VIDIOCSYNC and bad data)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Tuukka Toivonen <tuukkat@xxxxxxxxxx> writes:

> I don't think this is so efficient with just one mmap buffer. The empty
> mmap buffer is not available before application calls CAPTURE, because
> before that it's used for the previous frame. SYNC will be likely called
> just after CAPTURE,

That isn't allways true, especially if the application wants to do
some CPU intensive processing on the buffers.

When doing streaming capture xawtv tries to queue all empty buffers it
has as fast as possible, there is usually alot of time between
MCAPTURE and SYNC ioctls, at least if more that one buffer is provided
by the application.

> mmap buffer usage: frame0 -> CAPTURE -> available -> SYNC -> frame1
> 
> Using multiple mmap buffers, yes, but where's the point?

Let video application and capture hardware work in parallel:

MCAPTURE(0)
while (true) {
        MCAPTURE(1)
        SYNC(0)
        // application processes frame 0 while the hardware/driver fills frame 1
        MCAPTURE(0)
        SYNC(1)
        // application processes frame 1 while the hardware/driver fills frame 0
}

To do something simliar with just one buffer the application would
need one extra memcpy:

MCAPTURE(0)
while (true) {
        SYNC(0)
        memcpy frame
        MCAPTURE(0)
        // process frame while hardware/driver refills frame
}

  Gerd

-- 
sigfault




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux