[FFmpeg-cvslog] Revert "Acquire lock when initializing parsers."

Michael Niedermayer git at videolan.org
Thu Dec 6 03:17:38 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Dec  6 01:35:44 2012 +0100| [0393cf15dbe3b136647b81676a105815924eebcd] | committer: Michael Niedermayer

Revert "Acquire lock when initializing parsers."

This reverts commit 7feef7dbca5f6a816e04b63c17aad5dacd272f6e.

This commit causes assertion failures due to use of parser_init from multiple
threads, for example indirectly by ffmpeg.c and more directly from the
packet read functions.

I dont know how to fix this quickly, and fixing ffmpeg.c leaves
the possibility of other applications being affected.
Crashing the applications until this is resolved is clearly no good
thus this revert, so we have time to think about the problem.

Crashes can be reproduced by using multiple input files in ffmpeg.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0393cf15dbe3b136647b81676a105815924eebcd
---

 libavcodec/parser.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index e2a6f08..2e204e2 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -23,7 +23,6 @@
 #include <string.h>
 
 #include "parser.h"
-#include "internal.h"
 #include "libavutil/mem.h"
 
 static AVCodecParser *av_first_parser = NULL;
@@ -68,10 +67,7 @@ AVCodecParserContext *av_parser_init(int codec_id)
     s->fetch_timestamp=1;
     s->pict_type = AV_PICTURE_TYPE_I;
     if (parser->parser_init) {
-        if (ff_lock_avcodec(NULL) < 0)
-            goto err_out;
         ret = parser->parser_init(s);
-        ff_unlock_avcodec();
         if (ret != 0)
             goto err_out;
     }
@@ -206,11 +202,8 @@ int av_parser_change(AVCodecParserContext *s,
 void av_parser_close(AVCodecParserContext *s)
 {
     if(s){
-        if (s->parser->parser_close) {
-            ff_lock_avcodec(NULL);
+        if (s->parser->parser_close)
             s->parser->parser_close(s);
-            ff_unlock_avcodec();
-        }
         av_free(s->priv_data);
         av_free(s);
     }



More information about the ffmpeg-cvslog mailing list