Re: Re: v4l2 + mmap()

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



On 01-Jun-01 Bill Dirks wrote:
> "Nemosoft Unv." wrote:
>> but Im missing one detail: what happens when program cant
>> dequeue fast enough (or deliberately throttles the framerate).
>> More specifically: when the queue is full, do you drop the
>> last frame captured, or the oldest?
> 
> To be honest, I never thought of doing it that way. It's not specified.
> I believe the API will permit the driver to do it either way. I assumed
> the driver will skip a frame if there is no available buffer to put it
> in.
> 
> Reusing the oldest filled buffer seems just as easy, but it buys you
> nothing, IMHO. If you need low latency then use fewer buffers. If you're
> capturing to a file, then it simply doesn't matter which frame is the
> one that gets dropped.

I disagree; sometimes you need buffering AND still get the latest data
available. When, you might ask? While recording videos with sound.

Suppose I´m recording at 10 fps, and I have 4 buffers in my program, to
accomodate for temporary slow disk access; at the same time, I´m recording 
sound and trying to keep the two things in sync. Now since I´m reading data
slower than the card delivers, there will always be old data in the queue,
and in effect, my images will lag behind the sound. In the example above
(which is not exaggerated) the video will be 400 ms behind the audio; this
is clearly noticable to a viewer. So I would rather have my queue always
contains the last few frames, and simply discard the oldest.

As I said, in my own pwc driver I would first drop the last frame, but this
was clearly noticable. Dropping the oldest frame and moving the rest forward
clearly gave a better perception.

NB: trying to fix the problem mentioned above by delaying the sound by 400
ms isn´t really the solution either. I have a bttv card myself, I may be
able to try and implement a feature (or a switch) in the v4l2 driver myself.

 - Nemosoft

-----------------------------------------------------------------------------
Try SorceryNet!   One of the best IRC-networks around!   irc.sorcery.net:9000
URL: never        IRC: nemosoft      IscaBBS (bbs.isca.uiowa.edu): Nemosoft
                        >> Never mind the daylight << 





[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