[FFmpeg-devel] [PATCH] libavfilter-soc: make ffplay.c:request_input_frame() check for got_frame

Stefano Sabatini stefano.sabatini-lala
Sun Jan 11 17:29:19 CET 2009


On date Sunday 2009-01-11 15:20:29 +0100, Michael Niedermayer encoded:
> On Sun, Jan 11, 2009 at 01:38:12PM +0100, Stefano Sabatini wrote:
[...]
> > I was committing the change where I saw there was a (maybe) simpler
> > solution.
> > No need to change the get_video_frame() signature, after all it should
> > a duty of the get_video_frame() function to ensure that it is indeed
> > getting a frame, this change should be functionally equivalent to the
> > other patch.
> > 
> > Regards.
> > -- 
> > FFmpeg = Foolish and Fostering Minimal Portable Extreme Game
> 
> > Index: libavfilter-soc/ffmpeg/ffplay.c
> > ===================================================================
> > --- libavfilter-soc.orig/ffmpeg/ffplay.c	2009-01-11 12:27:12.000000000 +0100
> > +++ libavfilter-soc/ffmpeg/ffplay.c	2009-01-11 12:27:38.000000000 +0100
> > @@ -1407,8 +1407,9 @@
> >  
> >  static int get_video_frame(VideoState *is, AVFrame *frame, uint64_t *pts, AVPacket *pkt)
> >  {
> > -    int len1, got_picture;
> > +    int len1, got_picture = 0;
> >  
> > +    while (!got_picture) {
> >      if (packet_queue_get(&is->videoq, pkt, 1) < 0)
> >          return -1;
> >  
> > @@ -1423,6 +1424,7 @@
> >      len1 = avcodec_decode_video(is->video_st->codec,
> >                                  frame, &got_picture,
> >                                  pkt->data, pkt->size);
> > +    }
> 
> are you ever freeing the packets?

Good catch.

First patch changes the signature of get_video_frame, second one
introduces a loop in input_request_frame so that is checked that
get_video_frame effectively got a frame, otherwise try to extract
another frame, packets are always freed.

Regards.
-- 
FFmpeg = Fierce & Faboulous Merciful Ponderous Everlasting Gadget
-------------- next part --------------
A non-text attachment was scrubbed...
Name: change-get-video-frame.patch
Type: text/x-diff
Size: 1619 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090111/29ea027a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffplay-check-for-got-frame.patch
Type: text/x-diff
Size: 1137 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090111/29ea027a/attachment-0001.patch>



More information about the ffmpeg-devel mailing list