1 From 0fbee8f37427b88339194b22ba9aa210772a8613 Mon Sep 17 00:00:00 2001
2 From: Matthew Waters <matthew@centricular.com>
3 Date: Thu, 10 Nov 2016 17:20:27 +1100
4 Subject: [PATCH] smoothstreaming: use the duration from the list of fragments
5 if not present in the manifest
7 Provides a more accurate duration for live streams that may be minutes
8 or hours in front of the earliest fragment.
10 https://bugzilla.gnome.org/show_bug.cgi?id=774178
12 Upstream-Status: Backport
13 Signed-off-by: Khem Raj <raj.khem@gmail.com>
15 ext/smoothstreaming/gstmssmanifest.c | 24 ++++++++++++++++++++++++
16 1 file changed, 24 insertions(+)
18 diff --git a/ext/smoothstreaming/gstmssmanifest.c b/ext/smoothstreaming/gstmssmanifest.c
19 index 317b3cef9..144bbb42d 100644
20 --- a/ext/smoothstreaming/gstmssmanifest.c
21 +++ b/ext/smoothstreaming/gstmssmanifest.c
22 @@ -888,6 +888,7 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
26 + /* try the property */
28 (gchar *) xmlGetProp (manifest->xmlrootnode,
29 (xmlChar *) MSS_PROP_STREAM_DURATION);
30 @@ -895,6 +896,29 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
31 dur = g_ascii_strtoull (duration, NULL, 10);
34 + /* else use the fragment list */
36 + guint64 max_dur = 0;
39 + for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
40 + GstMssStream *stream = iter->data;
42 + if (stream->active) {
43 + if (stream->fragments) {
44 + GList *l = g_list_last (stream->fragments);
45 + GstMssStreamFragment *fragment = (GstMssStreamFragment *) l->data;
47 + fragment->time + fragment->duration * fragment->repetitions;
48 + max_dur = MAX (frag_dur, max_dur);