[FFmpeg-devel] [PATCH] lavf: exit try_decode_frame if nothing decoded.

Nicolas George nicolas.george at normalesup.org
Sun Jan 29 16:55:14 CET 2012


This fixes an infinite loop with (at least) some FLV files downloaded from
Dailymotion with RTMP.

Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---


I can provide the sample if necessary. It seems to be related to the broken
first frames in H.264. Otoh, libav seems to handle the file fine: I am
looking into it.


 libavformat/utils.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 912c2ba..cf3c052 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2141,7 +2141,9 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
         default:
             break;
         }
-        if (ret >= 0) {
+        if (!ret)
+            return 0;
+        if (ret > 0) {
             if (got_picture)
                 st->info->nb_decoded_frames++;
             pkt.data += ret;
-- 
1.7.8.3



More information about the ffmpeg-devel mailing list