[FFmpeg-devel] [PATCH 1/2] file: operate in blocks, check for interrupts

Michael Niedermayer michaelni at gmx.at
Wed Jul 10 22:24:51 CEST 2013


On Wed, Jul 10, 2013 at 10:31:29PM +0300, Andrey Utkin wrote:
> 2013/7/10 Michael Niedermayer <michaelni at gmx.at>:
> > This probably makes most sense
> > extending the callback is tricky though due to AVIOInterruptCB not
> > having any flags and being non extensible.
> > The cleanest solution i see ATM would be adding a special case
> > something like
> > if(cb->callback == CHECK_INT && *(int*)cb->callback->opaque > 0)
> >     return AVERROR_EXIT
> >
> > This does no callback at all but just checks an integer from a user
> > provided pointer so its not affected by the user mistakely providing
> > a slow callback. And this kind of check could then be done in the
> > retry_transfer_wrapper loop
> 
> I no longer think that such optimization is a good idea.
> The rationale (possible slow callbacks) is very questionable.
> I have even sat to code it, but then got confused.
> Now retry_interrupt_wrapper() works this way
> 
> while (len < size_min) {
>     /* try transfer */
>     ff_check_interrupt();
> }
> 
> With what you proposed, it would look this way
> 
> while (len < size_min) {
>     /* check interrupt in special case, using AVIOInterruptCB
> directly, which is ugly by itself */
>     /* try transfer */
>     /* check interrupt */
> }
> 

> This makes things complicated, and the reason is supporting slow
> callbacks - while being unsure if they exist.

true

It should be documented that the function may be called often and
thus should be very simple&fast and just check a variable

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/20130710/cc9c764a/attachment.asc>


More information about the ffmpeg-devel mailing list