diff options
author | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-03-16 16:07:37 -0300 |
---|---|---|
committer | Thiago Santos <ts.santos@sisa.samsung.com> | 2014-03-16 16:11:04 -0300 |
commit | dfc160d000e62acc6f36ad3b1dd5664256d2292d (patch) | |
tree | 03ee1e3ae0c6687e16f22943f65a214bdb2e31b4 | |
parent | fa24c94154b6d66ca118fedef785b4ade9617bd0 (diff) |
dashdemux: avoid advancing 2 fragments when an error happensurisrc
It would be possible to call download_loop twice in certain codepaths
scenarios when handling errors from on-demand streams
-rw-r--r-- | ext/dash/gstdashdemux.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index e1dad4274..529eb77bf 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -418,6 +418,7 @@ gst_dash_demux_handle_stream_download_error (GstDashDemuxStream * stream) { gboolean ret = FALSE; GstDashDemux *demux = stream->demux; + gboolean handled = FALSE; /* Download failed 'by itself' * in case this is live, we might be ahead or before playback, where @@ -467,28 +468,29 @@ gst_dash_demux_handle_stream_download_error (GstDashDemuxStream * stream) * have wrong total duration */ /* TODO which thread is calling this? Could be our own thread or the * urisrc thread */ - if (gst_dash_demux_stream_download_loop (stream) == GST_FLOW_EOS) { - return ret; - } + gst_dash_demux_stream_download_loop (stream); + handled = TRUE; } } - if (stream->failed_count < DEFAULT_FAILED_COUNT) { - gchar *uri; + if (!handled) { + if (stream->failed_count < DEFAULT_FAILED_COUNT) { + gchar *uri; - GST_WARNING_OBJECT (stream->pad, "Could not fetch the next fragment"); + GST_WARNING_OBJECT (stream->pad, "Could not fetch the next fragment"); - /* re-set the uri to start again */ - g_object_get (stream->urisrc, "uri", &uri, NULL); - g_object_set (stream->urisrc, "uri", uri, NULL); + /* re-set the uri to start again */ + g_object_get (stream->urisrc, "uri", &uri, NULL); + g_object_set (stream->urisrc, "uri", uri, NULL); - } else { - /* post our own message first */ - GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND, - ("Could not download fragment"), (NULL)); - g_object_set (stream->urisrc, "range-start", (gint64) - 1, - "range-end", (gint64) - 1, "uri", NULL, NULL); - ret = TRUE; + } else { + /* post our own message first */ + GST_ELEMENT_ERROR (demux, RESOURCE, NOT_FOUND, + ("Could not download fragment"), (NULL)); + g_object_set (stream->urisrc, "range-start", (gint64) - 1, + "range-end", (gint64) - 1, "uri", NULL, NULL); + ret = TRUE; + } } return ret; @@ -527,8 +529,6 @@ gst_dash_demux_handle_message (GstBin * bin, GstMessage * message) if (!gst_dash_demux_handle_stream_download_error (stream)) { gst_message_unref (message); message = NULL; - - gst_dash_demux_stream_download_loop (stream); } break; } |