dshow: protect access to curbufsize
authorrogerdpack <rogerpack2005@gmail.com>
Thu, 16 Aug 2012 16:43:40 +0000 (10:43 -0600)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 19 Aug 2012 16:36:26 +0000 (18:36 +0200)
Signed-off-by: rogerdpack <rogerpack2005@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavdevice/dshow.c

index 3a2d6e1..ac207b8 100644 (file)
@@ -920,6 +920,7 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
             *pkt = pktl->pkt;
             ctx->pktl = ctx->pktl->next;
             av_free(pktl);
+            ctx->curbufsize -= pkt->size;
         }
         ResetEvent(ctx->event);
         ReleaseMutex(ctx->mutex);
@@ -932,8 +933,6 @@ static int dshow_read_packet(AVFormatContext *s, AVPacket *pkt)
         }
     }
 
-    ctx->curbufsize -= pkt->size;
-
     return pkt->size;
 }