mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 14:36:41 +00:00
smoothstreaming: use the duration from the list of fragments if not present in the manifest
Provides a more accurate duration for live streams that may be minutes or hours in front of the earliest fragment. https://bugzilla.gnome.org/show_bug.cgi?id=774178
This commit is contained in:
parent
e9178fa082
commit
0fbee8f374
1 changed files with 24 additions and 0 deletions
|
@ -888,6 +888,7 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
|
||||||
gchar *duration;
|
gchar *duration;
|
||||||
guint64 dur = -1;
|
guint64 dur = -1;
|
||||||
|
|
||||||
|
/* try the property */
|
||||||
duration =
|
duration =
|
||||||
(gchar *) xmlGetProp (manifest->xmlrootnode,
|
(gchar *) xmlGetProp (manifest->xmlrootnode,
|
||||||
(xmlChar *) MSS_PROP_STREAM_DURATION);
|
(xmlChar *) MSS_PROP_STREAM_DURATION);
|
||||||
|
@ -895,6 +896,29 @@ gst_mss_manifest_get_duration (GstMssManifest * manifest)
|
||||||
dur = g_ascii_strtoull (duration, NULL, 10);
|
dur = g_ascii_strtoull (duration, NULL, 10);
|
||||||
xmlFree (duration);
|
xmlFree (duration);
|
||||||
}
|
}
|
||||||
|
/* else use the fragment list */
|
||||||
|
if (dur <= 0) {
|
||||||
|
guint64 max_dur = 0;
|
||||||
|
GSList *iter;
|
||||||
|
|
||||||
|
for (iter = manifest->streams; iter; iter = g_slist_next (iter)) {
|
||||||
|
GstMssStream *stream = iter->data;
|
||||||
|
|
||||||
|
if (stream->active) {
|
||||||
|
if (stream->fragments) {
|
||||||
|
GList *l = g_list_last (stream->fragments);
|
||||||
|
GstMssStreamFragment *fragment = (GstMssStreamFragment *) l->data;
|
||||||
|
guint64 frag_dur =
|
||||||
|
fragment->time + fragment->duration * fragment->repetitions;
|
||||||
|
max_dur = MAX (frag_dur, max_dur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max_dur != 0)
|
||||||
|
dur = max_dur;
|
||||||
|
}
|
||||||
|
|
||||||
return dur;
|
return dur;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue