adaptivedemux: fix 'utc now' gdatetime creation

It broke after removal of usage of GTimeVal that was deprecated,
it requires seconds in this unix-based creation instead of microseconds.

The downside here is that it will create an extra object just to be
discarded in order to add the microsecond part to it.

It would end up segfaulting as it would return a NULL value
This commit is contained in:
Thiago Santos 2019-11-19 19:29:26 -08:00 committed by GStreamer Merge Bot
parent 19391ae4c7
commit 3c5e5f8b85

View file

@ -4476,10 +4476,18 @@ GDateTime *
gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux)
{
GstClockTime rtc_now;
GDateTime *unix_datetime;
GDateTime *result_datetime;
gint64 utc_now_in_us;
rtc_now = gst_clock_get_time (demux->realtime_clock);
return g_date_time_new_from_unix_utc (demux->clock_offset +
GST_TIME_AS_USECONDS (rtc_now));
utc_now_in_us = demux->clock_offset + GST_TIME_AS_USECONDS (rtc_now);
unix_datetime =
g_date_time_new_from_unix_utc (utc_now_in_us / G_TIME_SPAN_SECOND);
result_datetime =
g_date_time_add (unix_datetime, utc_now_in_us % G_TIME_SPAN_SECOND);
g_date_time_unref (unix_datetime);
return result_datetime;
}
/**