summaryrefslogtreecommitdiff
path: root/ext/hls
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2015-01-07 09:21:33 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2015-01-07 09:30:40 -0300
commitc79e8a78acbafb707dc923f4b3688f0593244890 (patch)
tree5cd28316dcad6430830f9d344b4db617dd597897 /ext/hls
parentcd6069f5af03b35fd0182ac9dfac3b4c0eccbe4d (diff)
downloadgstreamer-plugins-bad-c79e8a78acbafb707dc923f4b3688f0593244890.tar.gz
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
Diffstat (limited to 'ext/hls')
-rwxr-xr-xext/hls/m3u8.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index ee0a45d84..35b25a866 100755
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -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;