From fe0506004450468f35f167be2700f86cd12ed39d Mon Sep 17 00:00:00 2001 From: Gianluca Gennari Date: Fri, 19 Oct 2012 19:03:41 +0200 Subject: [PATCH] dashdemux: do not send bogus duration messages when mediaPresentationDuration is unknown --- ext/dash/gstdashdemux.c | 9 ++++++--- ext/dash/gstmpdparser.c | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index bf1655ada2..0832e7b660 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -673,12 +673,15 @@ gst_dash_demux_sink_event (GstPad * pad, GstEvent * event) if (!gst_mpd_client_is_live (demux->client)) { GstClockTime duration = gst_mpd_client_get_duration (demux->client); - GST_DEBUG_OBJECT (demux, "Sending duration message : %" GST_TIME_FORMAT, - GST_TIME_ARGS (duration)); - if (duration != GST_CLOCK_TIME_NONE) + if (duration != GST_CLOCK_TIME_NONE) { + GST_DEBUG_OBJECT (demux, "Sending duration message : %" GST_TIME_FORMAT, + GST_TIME_ARGS (duration)); gst_element_post_message (GST_ELEMENT (demux), gst_message_new_duration (GST_OBJECT (demux), GST_FORMAT_TIME, duration)); + } else { + GST_DEBUG_OBJECT (demux, "mediaPresentationDuration unknown, can not send the duration message"); + } } gst_dash_demux_resume_download_task (demux); gst_dash_demux_resume_stream_task (demux); diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index e508ff5f4a..e0ffbb16cd 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -2934,9 +2934,10 @@ gst_mpd_client_get_duration (GstMpdClient * client) g_return_val_if_fail (client != NULL, GST_CLOCK_TIME_NONE); GST_MPD_CLIENT_LOCK (client); - duration = client->mpd_node->mediaPresentationDuration * GST_MSECOND; - /* We can only get the duration for on-demand streams */ - if (!duration) { + if (client->mpd_node->mediaPresentationDuration != -1) { + duration = client->mpd_node->mediaPresentationDuration * GST_MSECOND; + } else { + /* We can only get the duration for on-demand streams */ duration = GST_CLOCK_TIME_NONE; } GST_MPD_CLIENT_UNLOCK (client);