mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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:
parent
19391ae4c7
commit
3c5e5f8b85
1 changed files with 10 additions and 2 deletions
|
@ -4476,10 +4476,18 @@ GDateTime *
|
||||||
gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux)
|
gst_adaptive_demux_get_client_now_utc (GstAdaptiveDemux * demux)
|
||||||
{
|
{
|
||||||
GstClockTime rtc_now;
|
GstClockTime rtc_now;
|
||||||
|
GDateTime *unix_datetime;
|
||||||
|
GDateTime *result_datetime;
|
||||||
|
gint64 utc_now_in_us;
|
||||||
|
|
||||||
rtc_now = gst_clock_get_time (demux->realtime_clock);
|
rtc_now = gst_clock_get_time (demux->realtime_clock);
|
||||||
return g_date_time_new_from_unix_utc (demux->clock_offset +
|
utc_now_in_us = demux->clock_offset + GST_TIME_AS_USECONDS (rtc_now);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue