[FFmpeg-devel] Allow interrupt callback for AVCodecContext
Reimar.Doeffinger at gmx.de
Mon Jan 6 10:39:02 CET 2014
On 16.12.2013, at 07:21, "Don Moir" <donmoir at comcast.net> wrote:
> So you have to ask what the real hack is. Keeping an opened cached context or having an interrupt callback. An interrupt callback does not use any additional resources but then it has to be implemented for every decoder. An opened context works now, but uses addtional resources and mostly opened threads that are more or less dormant. Having an interruptible intense process is normal and not a hack and you should not have to beat it to death to get it to work.
Sorry, but the main problem with an interrupt callback is that it just does not work properly.
There is always going to be some place where it isn't called, and it might take quite some time.
So you can't know how long it will actually process it, and it may or may not be fast enough for you. Everyone using it will have a different overhead/responsiveness ratio they find acceptable.
For example testing it at the end of each slice might be good enough for some and low-cost, but will not work for videos that do not use slices.
Testing after each macroblocks risks having a high overhead, mostly due to branch prediction costs and entries in jump target tables etc.
Testing after each macroblock row might not be good enough for very wide videos and/or if it also has to work for corrupted frames.
In other words: I think this looks so attractive to you because it would work well if it was implemented specifically _just for you_. But having code specifically for one person in such a large project doesn't make much sense.
Also, if these additional resources are relevant the better solution would be to reduce resource usage of FFmpeg, that is something everyone would benefit from.
More information about the ffmpeg-devel