GNOME Bugzilla – Bug 776601
rtspsrc: set absolute range headers if only UTC is accepted
Last modified: 2018-11-03 15:15:32 UTC
Created attachment 342599 [details] [review] USe absolute clock range if only UTC is accepted Attached please find 2 patches, one against plugins-good, and one smaller one for plugins-base. Basically if during SETUP in the response header we have 'Accept-Ranges':'UTC' then in `gen_range_header` I use absolute time instead of npt. This is a requirement when playing back ONVIF streams but would always make sense because if only UTC is accepted the server is waiting to get an absolute time (and not npt). Bug 762884 is relevant but the advantage of a generic solution is that it even works with `gst-launch` without the need to set up a signal handler and correct the headers.
Created attachment 342600 [details] [review] Add Accept-Ranges header GST_RTSP_HDR_ACCEPT_RANGES to parse `Accept-Ranges` in the SETUP response
Comment on attachment 342599 [details] [review] USe absolute clock range if only UTC is accepted Replaced with `git format-path`
Comment on attachment 342599 [details] [review] USe absolute clock range if only UTC is accepted replaced with 0001-rtspsrc-Use-absolute-clock-if-only-UTC-is-accepted.patch
Created attachment 342997 [details] [review] rtspsrc to use absolute clock if only UTC accepted
Comment on attachment 342600 [details] [review] Add Accept-Ranges header Bug 776929 was created with a patch against gst-plugins-base
Created attachment 344260 [details] [review] rtspsrc to use absolute clock if only UTC accepted use %02d instead of %2d when creating the absolute clock for dates that are 1-digit to be zero-padded.
Review of attachment 344260 [details] [review]: ::: gst/rtsp/gstrtspsrc.c @@ +6264,3 @@ + &respranges, 0); + src->need_utc_range = FALSE; + if (g_ascii_strcasecmp(respranges, "UTC") == 0) { Might be NULL, right? @@ +7192,3 @@ gchar val_str[G_ASCII_DTOSTR_BUF_SIZE] = { 0, }; + if (src->range && src->need_utc_range && src->range->min.type == GST_RTSP_TIME_UTC && src->range->max.type == GST_RTSP_TIME_UTC) { Who/how would the range ever be filled with an UTC range? @@ +7193,3 @@ + if (src->range && src->need_utc_range && src->range->min.type == GST_RTSP_TIME_UTC && src->range->max.type == GST_RTSP_TIME_UTC) { + // seconds = ((hours * 60) + mins) * 60 + secs; No C99/C++ comments @@ +7204,3 @@ + return g_strdup_printf("clock=%4d%02d%02dT%02d%02d%02dZ-%4d%02d%02dT%02d%02d%02dZ", + src->range->min2.year, src->range->min2.month, src->range->min2.day, hours1, mins1, secs1, + src->range->max2.year, src->range->max2.month, src->range->max2.day, hours2, mins2, secs2); Run gst-indent over the code @@ +7209,1 @@ if (src->range && src->range->min.type == GST_RTSP_TIME_NOW) { This should probably become "if (...) { } else if (...) { }" etc, simplified a bit
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/337.