hlssink: round segment duration to nearest number of seconds

E.g. for 1s period, duration can be 0.99s, rounds down to 0, results in invalid
playlist

https://bugzilla.gnome.org/show_bug.cgi?id=689822
This commit is contained in:
Victor Gottardi 2012-12-05 10:06:38 -05:00 committed by Tim-Philipp Müller
parent c313b7e212
commit 4fb227b340

View file

@ -82,7 +82,8 @@ gst_m3u8_entry_render (GstM3U8Entry * entry, guint version)
if (TRUE)
return g_strdup_printf ("%s" M3U8_INT_INF_TAG,
entry->discontinuous ? M3U8_DISCONTINUITY_TAG : "",
(gint) (entry->duration / GST_SECOND), entry->title, entry->url);
(gint) ((entry->duration + 500 * GST_MSECOND) / GST_SECOND),
entry->title, entry->url);
return g_strdup_printf ("%s" M3U8_FLOAT_INF_TAG,
entry->discontinuous ? M3U8_DISCONTINUITY_TAG : "",
@ -161,7 +162,7 @@ gst_m3u8_playlist_target_duration (GstM3U8Playlist * playlist)
target_duration = entry->duration;
}
return (guint) (target_duration / GST_SECOND);
return (guint) ((target_duration + 500 * GST_MSECOND) / GST_SECOND);
}
static void