pthread: Fix crash due to fctx->delaying not being cleared.
authorDale Curtis <dalecurtis@chromium.org>
Fri, 13 Apr 2012 00:12:27 +0000 (17:12 -0700)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Apr 2012 09:10:38 +0000 (11:10 +0200)
corrects invalid return when avpkt->size == 0.

Reproducible with test case and ffplay -threads 2. Stack trace:
http://pastebin.com/PexZ4Uc0

Test case:
http://commondatastorage.googleapis.com/dalecurtis-shared/crash.ogm

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/pthread.c

index c23098f..79abd26 100644 (file)
@@ -614,11 +614,12 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
      * If we're still receiving the initial packets, don't return a frame.
      */
 
-    if (fctx->delaying && avpkt->size) {
+    if (fctx->delaying) {
         if (fctx->next_decoding >= (avctx->thread_count-1)) fctx->delaying = 0;
 
         *got_picture_ptr=0;
-        return avpkt->size;
+        if (avpkt->size)
+            return avpkt->size;
     }
 
     /*