[FFmpeg-devel] Tee improvement - discussion

Nicolas George george at nsup.org
Thu May 19 11:44:51 CEST 2016

Le tridi 23 floréal, an CCXXIV, Jan Sebechlebsky a écrit :
> My current idea is to create queue for each output (as Marton suggested) and
> process each output in separate thread. I was also considering using just
> single queue, but since the AVPackets are referenced counted, the memory
> overhead is negligible and using multiple queues will simplify the code.
> Apart from getting advantage of non-blocking processing with multiple slave
> muxers, error handling will also be improved.
> Another question is what to do when some of the queues becomes full,
> discussed options were so far:
>     - Block write_packet call until the queue frees - this might be useful
> when producer is faster than consumer, and we don't want to drop any packets
> when recording to file.
>     - Drop some yet unprocessed packets (until next keyframe, or free some
> portion of queue) to free the queue - this might be useful for network
> outputs.

I must say, I am not very happy with the direction this project takes.

Non-blocking muxers (and demuxers, and protocols) is a white whale for our
API: we really really want it, but it huge and very hard to catch.

It is something that needs to be implemented globally with a very careful
design. Definitely not something that can be added in a corner of an obscure
muxer. We already went down that path twice, with the thread for the UDP
protocol and with running demuxer in threads in FFmpeg. Both did lead to
endless complications: bugs, inconsistencies, portability trouble.

If you want to work on that (in order to bring these enhancements to the tee
muxer, fitting the topic of the GSoC project), you probably can. But I
expect this to be very hard. It has been rejected as a proposal for a GSoC
project in the past on the basis that it is probably too hard for a random
student. Also, I am not sure that Marton, your official mentor, would want
such a huge shift in the project's goals.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160519/4611c8a5/attachment.sig>

More information about the ffmpeg-devel mailing list