diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-11-27 21:57:33 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-12-05 21:01:17 +0100 |
commit | 7feef7dbca5f6a816e04b63c17aad5dacd272f6e (patch) | |
tree | b64f1e3454c257eadd694644a958a5808e707d0e | |
parent | 25fec8595d3a050d926f8145729288ae6e8d6a1a (diff) | |
download | ffmpeg-7feef7dbca5f6a816e04b63c17aad5dacd272f6e.tar.gz |
Acquire lock when initializing parsers.
This is necessary since they might be initializing or
even using static VLC tables.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
-rw-r--r-- | libavcodec/parser.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 2e204e2c2a..e2a6f082c8 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -23,6 +23,7 @@ #include <string.h> #include "parser.h" +#include "internal.h" #include "libavutil/mem.h" static AVCodecParser *av_first_parser = NULL; @@ -67,7 +68,10 @@ 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; } @@ -202,8 +206,11 @@ int av_parser_change(AVCodecParserContext *s, void av_parser_close(AVCodecParserContext *s) { if(s){ - if (s->parser->parser_close) + if (s->parser->parser_close) { + ff_lock_avcodec(NULL); s->parser->parser_close(s); + ff_unlock_avcodec(); + } av_free(s->priv_data); av_free(s); } |