/* schedule the next update using the target duration field of the
* playlist */
- demux->next_update += gst_m3u8_client_get_target_duration (demux->client)
+ demux->next_update +=
+ gst_m3u8_client_get_current_fragment_duration (demux->client)
/ GST_SECOND * G_USEC_PER_SEC * update_factor;
GST_DEBUG_OBJECT (demux, "Next update scheduled at %" G_GINT64_FORMAT,
demux->next_update);
return ret;
}
+static gint
+_find_current (GstM3U8MediaFile * file, GstM3U8Client * client)
+{
+ return file->sequence == client->sequence;
+}
+
static gboolean
_find_next (GstM3U8MediaFile * file, GstM3U8Client * client)
{
g_free (uri_copy);
return ret;
}
+
+guint64
+gst_m3u8_client_get_current_fragment_duration (GstM3U8Client * client)
+{
+ guint64 dur;
+ GList *list;
+
+ g_return_val_if_fail (client != NULL, 0);
+
+ GST_M3U8_CLIENT_LOCK (client);
+
+ list = g_list_find_custom (client->current->files, client,
+ (GCompareFunc) _find_current);
+ if (list == NULL) {
+ dur = -1;
+ } else {
+ dur = GST_M3U8_MEDIA_FILE (list->data)->duration;
+ }
+
+ GST_M3U8_CLIENT_UNLOCK (client);
+ return dur;
+}
GList * gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client,
guint bitrate);
+guint64 gst_m3u8_client_get_current_fragment_duration (GstM3U8Client * client);
+
G_END_DECLS
#endif /* __M3U8_H__ */