[FFmpeg-devel] [PATCH] udp: added option to ignore empty UDP packets
Nicolas George
george at nsup.org
Fri Oct 6 11:15:43 EEST 2017
Le quartidi 14 vendémiaire, an CCXXVI, Carl Eugen Hoyos a écrit :
> Just curious: Is it useful at all to exit on an empty packet?
It is not useful at all, it is a bug.
More specifically, when reading plain files, ret = 0 means EOF for plain
files, just because there is nothing more to read (but if the file
grows, more data is returned in a later read). This has been extended to
pipes and stream socket, and some devices, but not all. In particular,
ret = 0 means EOF neither for ttys nor for packet protocols.
In FFmpeg, we have AVERROR_EOF and use it for EOF. For consistency and
simplicity, it is better to have only one case, therefore ret = 0 should
not be used to mean EOF. Stream protocols should never return 0.
I agree that we have that mistake probably in a lot of places. Finding
and fixing all of them would be a huge work. Fortunately, it is not
absolutely necessary: fixing the cases that cause visible bugs for
actual users is enough.
And since empty packets are valid and can be used by applications (and
are actually used by protocols out there), the workaround of dropping
them is not acceptable.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171006/8e33cd8f/attachment.sig>
More information about the ffmpeg-devel
mailing list