mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-01 12:02:27 +00:00
hlsdemux: schedule next update based on the fragment duration
This commit is contained in:
parent
05efcbf757
commit
6e54b8ee53
3 changed files with 32 additions and 1 deletions
|
@ -1254,7 +1254,8 @@ gst_hls_demux_schedule (GstHLSDemux * demux)
|
|||
|
||||
/* 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);
|
||||
|
|
|
@ -555,6 +555,12 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static gint
|
||||
_find_current (GstM3U8MediaFile * file, GstM3U8Client * client)
|
||||
{
|
||||
return file->sequence == client->sequence;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_find_next (GstM3U8MediaFile * file, GstM3U8Client * client)
|
||||
{
|
||||
|
@ -786,3 +792,25 @@ out:
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -98,5 +98,7 @@ gboolean gst_m3u8_client_is_live(GstM3U8Client * client);
|
|||
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__ */
|
||||
|
|
Loading…
Reference in a new issue