1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/parser: Make av_register_codec_parser() thread safe

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-06-29 03:24:32 +02:00
parent 8738d94274
commit 08f6fdc3e4

View File

@ -23,6 +23,7 @@
#include <string.h>
#include "parser.h"
#include "libavutil/atomic.h"
#include "libavutil/mem.h"
static AVCodecParser *av_first_parser = NULL;
@ -34,8 +35,9 @@ AVCodecParser* av_parser_next(AVCodecParser *p){
void av_register_codec_parser(AVCodecParser *parser)
{
parser->next = av_first_parser;
av_first_parser = parser;
do {
parser->next = av_first_parser;
} while (parser->next != avpriv_atomic_ptr_cas((void * volatile *)&av_first_parser, parser->next, parser));
}
AVCodecParserContext *av_parser_init(int codec_id)