mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
hlsdemux: avoid using g_list_append for creating segments list
Use g_list_prepend and reverse it at the end to skip traversing the same list for every new segment
This commit is contained in:
parent
cd6069f5af
commit
c79e8a78ac
1 changed files with 5 additions and 4 deletions
|
@ -487,8 +487,7 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
|
|||
if (offset != -1) {
|
||||
file->offset = offset;
|
||||
} else {
|
||||
GstM3U8MediaFile *prev =
|
||||
self->files ? g_list_last (self->files)->data : NULL;
|
||||
GstM3U8MediaFile *prev = self->files ? self->files->data : NULL;
|
||||
|
||||
if (!prev) {
|
||||
offset = 0;
|
||||
|
@ -508,7 +507,7 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
|
|||
title = NULL;
|
||||
discontinuity = FALSE;
|
||||
size = offset = -1;
|
||||
self->files = g_list_append (self->files, file);
|
||||
self->files = g_list_prepend (self->files, file);
|
||||
}
|
||||
|
||||
} else if (g_str_has_prefix (data, "#EXT-X-ENDLIST")) {
|
||||
|
@ -696,6 +695,8 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
|
|||
g_free (current_key);
|
||||
current_key = NULL;
|
||||
|
||||
self->files = g_list_reverse (self->files);
|
||||
|
||||
/* reorder playlists by bitrate */
|
||||
if (self->lists) {
|
||||
gchar *top_variant_uri = NULL;
|
||||
|
@ -1116,7 +1117,7 @@ gst_m3u8_client_get_current_uri (GstM3U8Client * client)
|
|||
}
|
||||
|
||||
gboolean
|
||||
gst_m3u8_client_has_main(GstM3U8Client * client)
|
||||
gst_m3u8_client_has_main (GstM3U8Client * client)
|
||||
{
|
||||
gboolean ret;
|
||||
|
||||
|
|
Loading…
Reference in a new issue