mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
flvmux: Use thread-safe gmtime_r if available
gmtime on *nix is not thread-safe.
This commit is contained in:
parent
b44d37a338
commit
5009cad220
2 changed files with 10 additions and 5 deletions
|
@ -1077,7 +1077,7 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
||||||
|
|
||||||
{
|
{
|
||||||
time_t secs;
|
time_t secs;
|
||||||
struct tm *tm;
|
struct tm tm;
|
||||||
gchar *s;
|
gchar *s;
|
||||||
static const gchar *weekdays[] = {
|
static const gchar *weekdays[] = {
|
||||||
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||||
|
@ -1088,11 +1088,15 @@ gst_flv_mux_create_metadata (GstFlvMux * mux)
|
||||||
};
|
};
|
||||||
|
|
||||||
secs = g_get_real_time () / G_USEC_PER_SEC;
|
secs = g_get_real_time () / G_USEC_PER_SEC;
|
||||||
tm = gmtime (&secs);
|
#ifdef HAVE_GMTIME_R
|
||||||
|
gmtime_r (&secs, &tm);
|
||||||
|
#else
|
||||||
|
tm = *gmtime (&secs);
|
||||||
|
#endif
|
||||||
|
|
||||||
s = g_strdup_printf ("%s %s %d %02d:%02d:%02d %d", weekdays[tm->tm_wday],
|
s = g_strdup_printf ("%s %s %d %02d:%02d:%02d %d", weekdays[tm.tm_wday],
|
||||||
months[tm->tm_mon], tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
|
months[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec,
|
||||||
tm->tm_year + 1900);
|
tm.tm_year + 1900);
|
||||||
|
|
||||||
_gst_buffer_new_and_alloc (2 + 12 + 1 + 2 + strlen (s), &tmp, &data);
|
_gst_buffer_new_and_alloc (2 + 12 + 1 + 2 + strlen (s), &tmp, &data);
|
||||||
data[0] = 0; /* 12 bytes name */
|
data[0] = 0; /* 12 bytes name */
|
||||||
|
|
|
@ -151,6 +151,7 @@ check_functions = [
|
||||||
# check token HAVE_RDTSC
|
# check token HAVE_RDTSC
|
||||||
['HAVE_SINH', 'sinh', '#include<math.h>'],
|
['HAVE_SINH', 'sinh', '#include<math.h>'],
|
||||||
# check token HAVE_WAVEFORM
|
# check token HAVE_WAVEFORM
|
||||||
|
['HAVE_GMTIME_R', 'gmtime_r', '#include<time.h>'],
|
||||||
]
|
]
|
||||||
|
|
||||||
libm = cc.find_library('m', required : false)
|
libm = cc.find_library('m', required : false)
|
||||||
|
|
Loading…
Reference in a new issue