mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +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) {
|
if (offset != -1) {
|
||||||
file->offset = offset;
|
file->offset = offset;
|
||||||
} else {
|
} else {
|
||||||
GstM3U8MediaFile *prev =
|
GstM3U8MediaFile *prev = self->files ? self->files->data : NULL;
|
||||||
self->files ? g_list_last (self->files)->data : NULL;
|
|
||||||
|
|
||||||
if (!prev) {
|
if (!prev) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
@ -508,7 +507,7 @@ gst_m3u8_update (GstM3U8Client * client, GstM3U8 * self, gchar * data,
|
||||||
title = NULL;
|
title = NULL;
|
||||||
discontinuity = FALSE;
|
discontinuity = FALSE;
|
||||||
size = offset = -1;
|
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")) {
|
} 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);
|
g_free (current_key);
|
||||||
current_key = NULL;
|
current_key = NULL;
|
||||||
|
|
||||||
|
self->files = g_list_reverse (self->files);
|
||||||
|
|
||||||
/* reorder playlists by bitrate */
|
/* reorder playlists by bitrate */
|
||||||
if (self->lists) {
|
if (self->lists) {
|
||||||
gchar *top_variant_uri = NULL;
|
gchar *top_variant_uri = NULL;
|
||||||
|
@ -1116,7 +1117,7 @@ gst_m3u8_client_get_current_uri (GstM3U8Client * client)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_m3u8_client_has_main(GstM3U8Client * client)
|
gst_m3u8_client_has_main (GstM3U8Client * client)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue