@@ -25,6 +25,8 @@
* H.261 codec
*/
+#include "libavutil/thread.h"
+
#include "avcodec.h"
#include "h261.h"
@@ -80,13 +82,13 @@ void ff_h261_loop_filter(MpegEncContext *s)
h261_loop_filter(dest_cr, uvlinesize);
}
-av_cold void ff_h261_common_init(void)
+static av_cold void h261_common_init(void)
{
- static int done = 0;
-
- if (done)
- return;
-
ff_rl_init(&ff_h261_rl_tcoeff, ff_h261_rl_table_store);
- done = 1;
+}
+
+av_cold void ff_h261_common_init(void)
+{
+ static AVOnce init_static_once = AV_ONCE_INIT;
+ ff_thread_once(&init_static_once, h261_common_init);
}
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> --- libavcodec/h261.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)