diff options
author | Thiago Santos <thiagossantos@gmail.com> | 2019-11-19 19:29:26 -0800 |
---|---|---|
committer | GStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2019-11-20 22:16:15 +0000 |
commit | 3c5e5f8b85841442a30c10f1be9ed9fc4d326037 (patch) | |
tree | 0a4fbb26bac17f6b1636328e0753e1144890ac7c /gst-libs/gst/adaptivedemux | |
parent | 19391ae4c715cf35112496db90a9b3a6de82e19a (diff) |
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
Diffstat (limited to 'gst-libs/gst/adaptivedemux')
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index e84f7ecb1..0f27f7455 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -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; } /** |