[FFmpeg-cvslog] avcodec/bitstream_filter: make av_register_bitstream_filter() thread safe
Michael Niedermayer
git at videolan.org
Sat Jun 29 03:52:59 CEST 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jun 29 03:39:03 2013 +0200| [b36b5edb8fea33ebcacc0b77ce412372dd9f79e4] | committer: Michael Niedermayer
avcodec/bitstream_filter: make av_register_bitstream_filter() thread safe
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b36b5edb8fea33ebcacc0b77ce412372dd9f79e4
---
libavcodec/bitstream_filter.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
index 328a9f6..dd10531 100644
--- a/libavcodec/bitstream_filter.c
+++ b/libavcodec/bitstream_filter.c
@@ -21,6 +21,7 @@
#include <string.h>
#include "avcodec.h"
+#include "libavutil/atomic.h"
#include "libavutil/mem.h"
static AVBitStreamFilter *first_bitstream_filter= NULL;
@@ -31,8 +32,9 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f){
}
void av_register_bitstream_filter(AVBitStreamFilter *bsf){
- bsf->next = first_bitstream_filter;
- first_bitstream_filter= bsf;
+ do {
+ bsf->next = first_bitstream_filter;
+ } while(bsf->next != avpriv_atomic_ptr_cas((void * volatile *)&first_bitstream_filter, bsf->next, bsf));
}
AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){
More information about the ffmpeg-cvslog
mailing list