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
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel