summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dash/gstdashdemux.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index 9bbc5ae03..4c1f999c9 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -1992,15 +1992,17 @@ static GstDateTime *
gst_dash_demux_parse_http_xsdate (GstDashDemuxClockDrift * clock_drift,
GstBuffer * buffer)
{
- GstDateTime *value;
+ GstDateTime *value = NULL;
GstMapInfo mapinfo;
/* the string from the server might not be zero terminated */
- gst_buffer_resize (buffer, 0, gst_buffer_get_size (buffer) + 1);
- gst_buffer_map (buffer, &mapinfo, GST_MAP_READ | GST_MAP_WRITE);
- mapinfo.data[mapinfo.size - 1] = '\0';
- value = gst_date_time_new_from_iso8601_string ((const gchar *) mapinfo.data);
- gst_buffer_unmap (buffer, &mapinfo);
+ if (gst_buffer_map (buffer, &mapinfo, GST_MAP_READ)) {
+ gchar *str;
+ str = g_strndup ((const gchar *) mapinfo.data, mapinfo.size);
+ gst_buffer_unmap (buffer, &mapinfo);
+ value = gst_date_time_new_from_iso8601_string (str);
+ g_free (str);
+ }
return value;
}