Commit 76886589 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/wavenc: Use localtime_r() for thread saftey

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 32a2876b
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/time.h" #include "libavutil/time.h"
#include "libavutil/time_internal.h"
#include "avformat.h" #include "avformat.h"
#include "avio.h" #include "avio.h"
...@@ -267,10 +268,11 @@ static void peak_write_chunk(AVFormatContext *s) ...@@ -267,10 +268,11 @@ static void peak_write_chunk(AVFormatContext *s)
memset(timestamp, 0, sizeof(timestamp)); memset(timestamp, 0, sizeof(timestamp));
if (!(s->flags & AVFMT_FLAG_BITEXACT)) { if (!(s->flags & AVFMT_FLAG_BITEXACT)) {
struct tm tmpbuf;
av_log(s, AV_LOG_INFO, "Writing local time and date to Peak Envelope Chunk\n"); av_log(s, AV_LOG_INFO, "Writing local time and date to Peak Envelope Chunk\n");
now0 = av_gettime(); now0 = av_gettime();
now_secs = now0 / 1000000; now_secs = now0 / 1000000;
strftime(timestamp, sizeof(timestamp), "%Y:%m:%d:%H:%M:%S:", localtime(&now_secs)); strftime(timestamp, sizeof(timestamp), "%Y:%m:%d:%H:%M:%S:", localtime_r(&now_secs, &tmpbuf));
av_strlcatf(timestamp, sizeof(timestamp), "%03d", (int)((now0 / 1000) % 1000)); av_strlcatf(timestamp, sizeof(timestamp), "%03d", (int)((now0 / 1000) % 1000));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment