[FFmpeg-devel] [PATCH v2] fftools/ffmpeg_mux: fix reporting muxer EOF as error

Nicolas George george at nsup.org
Mon Apr 24 12:19:13 EEST 2023


Marton Balint (12023-04-24):
> The change in ffmpeg.c "forces" muxers to check if they ever get AVERROR_EOF
> for some real error condition and map them to e.g. AVERROR(EIO). And that is
> an API change.

Indeed. And the documentation agrees:

 * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush
 *
 * @see av_interleaved_write_frame()
 */
int av_write_frame(AVFormatContext *s, AVPacket *pkt);

 * @return 0 on success, a negative AVERROR on error.
 *
 * @see av_write_frame(), AVFormatContext.max_interleave_delta
 */
int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt);

No mention of EOF at all. Contrast with:

 * @return 0 if OK, < 0 on error or end of file. On error, pkt will be blank
 *         (as if it came from av_packet_alloc()).
 …
int av_read_frame(AVFormatContext *s, AVPacket *pkt);

When EOF is intended, it written in the documentation.

As it is, we should av_assert0(ret != AVERROR_EOF) in
av_interleaved_write_frame() and fix the possible failures.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230424/52d4fd0e/attachment.sig>


More information about the ffmpeg-devel mailing list