[FFmpeg-devel] [PATCH] ffmpeg; check return code of avcodec_send_frame when flushing encoders

Michael Niedermayer michael at niedermayer.cc
Tue Apr 18 13:17:45 EEST 2017


On Tue, Apr 18, 2017 at 07:09:30AM +0200, Nicolas George wrote:
> Le nonidi 29 germinal, an CCXXV, Michael Niedermayer a écrit :
> > > +                while ((ret = avcodec_receive_packet(enc, &pkt)) == AVERROR(EAGAIN)) {
> > > +                    ret = avcodec_send_frame(enc, NULL);
> 
> The doc says:
> 
> # The functions will not return AVERROR(EAGAIN), unless you forgot to
> # enter draining mode.

The full paragraph in the docs which you qoted from says this:
 * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet()
 *   (encoding) in a loop until AVERROR_EOF is returned. The functions will
 *   not return AVERROR(EAGAIN), unless you forgot to enter draining mode.

the patch adds a check to avcodec_send_frame()


> 
> > can the code be changed to not require this ?
> 
> I would say the code does not require this as is.

For decoding theres an explicit
"Sending the first flush packet will return success."

I cannot find similar for encoding, which is the case the patch changes
and what i think should be fixed if possible as it would be simpler,
making the patch unneeded.
Its quite possible iam missing something that makes it uneeded though


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170418/e20d1e51/attachment.sig>


More information about the ffmpeg-devel mailing list