[FFmpeg-devel] [PATCH 3/5] ffmpeg: flush and drain video filters.

Nicolas George nicolas.george at normalesup.org
Mon Mar 12 22:00:49 CET 2012

Le tridi 23 ventôse, an CCXX, Michael Niedermayer a écrit :
> this can easily be solved by requireing sinks to pull. Implementation
> wise it could be that every time theres some activity on a filter graph
> like a frame added, we would do
> for all sinks
>     while poll_frame()
>         request_frame()

That does not work: either poll_frame recurses, and that loop drains the
first output while the other accumulate frames; or poll_frame does not
recurse and it will never see beyond fifos.

What needs to be done is:

for all outputs
    if !frame_immediately_available()
for all outputs
    while frame_immediately_available()

> fifos are necessary in some cases.

Yes, but they need to be controlled.

> that would mean such filters would need internal fifos.

Yes. But fifos they can regulate.

And I think the following statement should be true for any filter:

Pushing a balanced flux unrequested frames on its inputs (what balanced
means being filter-dependant) should not cause frames to accumulate anywhere
before or inside the filter.

But all that is rather irrelevant for my point, which is: poll_frame, with
its current semantic, is redundant to request_frame+EAGAIN.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120312/25ec82de/attachment.asc>

More information about the ffmpeg-devel mailing list