summaryrefslogtreecommitdiff
path: root/ext/hls
diff options
context:
space:
mode:
authorJimmy Ohn <yongjin.ohn@lge.com>2015-05-14 02:11:50 +0900
committerSebastian Dröge <sebastian@centricular.com>2015-05-18 10:52:35 +0300
commit4ca3a22b6b33ad8be4383063e76f79c4d346535d (patch)
tree2a1d283552d4f2fe5b05b2673d92fecffd115daf /ext/hls
parent6b43d7f770c97761fe9ef20d821eef7befed7d9e (diff)
downloadgstreamer-plugins-bad-4ca3a22b6b33ad8be4383063e76f79c4d346535d.tar.gz
hlsdemux: Simplify logic in process_manifest
Simplify logic in process_manifest and remove a TODO item. https://bugzilla.gnome.org/show_bug.cgi?id=749328
Diffstat (limited to 'ext/hls')
-rw-r--r--ext/hls/gsthlsdemux.c16
-rwxr-xr-xext/hls/m3u8.c5
2 files changed, 10 insertions, 11 deletions
diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c
index 55138157f..85a9a91e4 100644
--- a/ext/hls/gsthlsdemux.c
+++ b/ext/hls/gsthlsdemux.c
@@ -438,18 +438,12 @@ gst_hls_demux_process_manifest (GstAdaptiveDemux * demux, GstBuffer * buf)
if (gst_m3u8_client_has_variant_playlist (hlsdemux->client)) {
GstM3U8 *child = NULL;
GError *err = NULL;
+ GList *current_variant = NULL;
- /* TODO seems like something that could be simplified */
- if (demux->connection_speed == 0) {
- GST_M3U8_CLIENT_LOCK (hlsdemux->client);
- child = hlsdemux->client->main->current_variant->data;
- GST_M3U8_CLIENT_UNLOCK (hlsdemux->client);
- } else {
- GList *tmp = gst_m3u8_client_get_playlist_for_bitrate (hlsdemux->client,
- demux->connection_speed);
-
- child = GST_M3U8 (tmp->data);
- }
+ current_variant =
+ gst_m3u8_client_get_playlist_for_bitrate (hlsdemux->client,
+ demux->connection_speed);
+ child = GST_M3U8 (current_variant->data);
gst_m3u8_client_set_current (hlsdemux->client, child);
if (!gst_hls_demux_update_playlist (hlsdemux, FALSE, &err)) {
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index 0d1f892de..bf33793b2 100755
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -1257,6 +1257,11 @@ gst_m3u8_client_get_playlist_for_bitrate (GstM3U8Client * client, guint bitrate)
GST_M3U8_CLIENT_LOCK (client);
current_variant = client->main->current_variant;
+ if (bitrate == 0) {
+ GST_M3U8_CLIENT_UNLOCK (client);
+ return current_variant;
+ }
+
/* Go to the highest possible bandwidth allowed */
while (GST_M3U8 (current_variant->data)->bandwidth <= bitrate) {
list = g_list_next (current_variant);