[FFmpeg-devel] [PATCH] fix ffplay eof memleak (issue806)

Michael Niedermayer michaelni
Sat Feb 14 11:19:35 CET 2009


On Sat, Feb 14, 2009 at 05:54:46PM +1100, Peter Ross wrote:
> On Sat, Feb 07, 2009 at 03:03:57AM +0100, Michael Niedermayer wrote:
> > On Sat, Feb 07, 2009 at 12:03:51PM +1100, Peter Ross wrote:
> > > $subject.
> > > 
> > > XREF: https://roundup.ffmpeg.org/roundup/ffmpeg/issue806
> > > 
> 
> > i remember problems with EOF detection, the return of url_* is just not
> > correct to detect it. The reason is they are related to the file pointer
> > and not if the demuxer reached the end of the available packets
> > we should add a special return code to indicate EOF maybe, someone
> > suggested that already not too long ago ..
> 
> This patch adds AVERROR_EOF, with demuxer modificatiojns for AVI and FLV.
> 
> > > +                av_free_packet(pkt);
> 
> > this looks wrong, a negative return from av_read_frame() really means
> > that no packet has been allocated
> 
> Right. There is something awry going on inside avidec.c. av_get_packet()
> is called, but is not free on an error or EOF condition.
> 
> -- Peter
> (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)

> Index: libavcodec/avcodec.h
> ===================================================================
> --- libavcodec/avcodec.h	(revision 17219)
> +++ libavcodec/avcodec.h	(working copy)
> @@ -3144,6 +3144,7 @@
>  #define AVERROR_NOFMT       AVERROR(EILSEQ)  /**< unknown format */
>  #define AVERROR_NOTSUPP     AVERROR(ENOSYS)  /**< Operation not supported. */
>  #define AVERROR_NOENT       AVERROR(ENOENT)  /**< No such file or directory. */
> +#define AVERROR_EOF         AVERROR(ECANCELED) /**< End of file. */
>  #define AVERROR_PATCHWELCOME    -MKTAG('P','A','W','E') /**< Not yet implemented in FFmpeg. Patches welcome. */
>  
>  #endif /* AVCODEC_AVCODEC_H */

iam fine with AVERROR_EOF but not sure if ECANCELED is best ...
but i have no other suggestioon either except maybe EPIPE

the rest looks ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090214/adff5988/attachment.pgp>



More information about the ffmpeg-devel mailing list