[FFmpeg-devel] [PATCH] Frame rate emulation

Michael Niedermayer michaelni
Mon Jun 18 22:49:59 CEST 2007


On Mon, Jun 18, 2007 at 04:53:16PM +0200, Luca Abeni wrote:
> Hi,
> Ramiro Ribeiro Polla wrote:
> [...]
> > The rate emulation code from x11grab.c was copied from grab.c, so new 
> > patch also removed that one.
> > 
> > Now I wonder... Why is waiting not a problem in v4l2.c? Around line 334, 
> > it whiles around if the error is EAGAIN. Isn't that also blocking FFmpeg?
> While I agree that calling the sleep function in grab.c can be wrong (it 
> always created a lot of problems to me), I do not think that v4l2 code 
> is wrong... It is synchronizing with the input, and I think a v4l2 input 
> format needs to synchronize with the input.
> (Anyway, the EAGAIN case should happen only if the ioctl() is 
> interrupted by a signal, no?)
> I think udp.c::udp_read() (and many other input functions) block when no 
> input packet is available, no?
> And what happens if you do
> ./ffmpeg -i pipe.mpg ...
> where "pipe.mpg" is a named pipe? I think each read for an input packet 
> will block until the packet is available, no? In my opinion, v4l2.c case 
> is similar.
> (and I think v4l2 is not doing "frame rate emulation", it is just 
> synchronizing with the real rate of the input...)

yes but IMHO no demuxer or protocol should be blocking like they do

> But if I am wrong, let me know how v4l2.c should behave, and I'll try to 
> fix it.

there should be a way to prevent demuxers & protocols from blocking if
no data is aviailable ...

an example where this might be fatal is a low fps webcam or rtp and a normal
tv capture at the same time, think of no rtp packets for a second or 2 and
v4l(2) having to buffer 50 frames or so

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070618/38834ee9/attachment.pgp>

More information about the ffmpeg-devel mailing list