[FFmpeg-devel] [RFC] Event loop

Anton Khirnov anton at khirnov.net
Fri Jan 1 14:54:13 EET 2021


Quoting Nicolas George (2020-12-31 14:37:21)
> This mail is about a project I have to make FFmpeg's API and
> infrastructure more convenient. For a common introduction, see this thread:
> https://ffmpeg.org/pipermail/ffmpeg-devel/2020-December/274167.html
> 
> The API to access our protocols, in particular network protocols, is copied
> from the Unix file descriptor API, basically read() and write(). While this
> API is very simple and convenient when it works, it works mostly only with
> simple applications that do with only one input or output at a time. Extra
> features like timeouts or handling several streams simultaneously are
> complex to add.
> 
> Furthermore, timeouts and non-blocking mode are currently done with a
> periodic polling, which makes the application always active and can prevent
> embedded devices from going into deep sleep, draining the battery.
> 
> I want to replace it with an event loop. That means that instead of reading
> on a protocol context, we would register a callback for when data is
> available, and then let the loop run.

I do not think this is a good idea. There are enough event loops in the
world and making yet another one is not in scope for us. What we should
do instead is allow clean integration with existing event loops, mainly
by exporting the underlying file descriptors so they can be poll()ed on.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list