diff options
author | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-09-16 13:53:45 -0300 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-09-18 18:36:38 +0200 |
commit | c84282b9a6bfe9383172c4f8ed28b655cfe84f2f (patch) | |
tree | 63e153076e959ee2d62d5d55e4570f0027b814c2 | |
parent | 6bb26264985d01a49b9d2b5f1251fc80fbaa2860 (diff) | |
download | gstreamer-plugins-good-c84282b9a6bfe9383172c4f8ed28b655cfe84f2f.tar.gz |
souphttpsrc: do not do http requests in READY
HEAD requests to discover if the server is seekable shouldn't be done in
READY as it might lock the main thread that is doing the state change.
https://bugzilla.gnome.org/show_bug.cgi?id=705371
-rw-r--r-- | ext/soup/gstsouphttpsrc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/soup/gstsouphttpsrc.c b/ext/soup/gstsouphttpsrc.c index 6c7f837bb..aa2d0ad3f 100644 --- a/ext/soup/gstsouphttpsrc.c +++ b/ext/soup/gstsouphttpsrc.c @@ -1384,17 +1384,16 @@ gst_soup_http_src_get_size (GstBaseSrc * bsrc, guint64 * size) return FALSE; } -static gboolean -gst_soup_http_src_is_seekable (GstBaseSrc * bsrc) +static void +gst_soup_http_src_check_seekable (GstSoupHTTPSrc * src) { - GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc); GstFlowReturn ret = GST_FLOW_OK; /* Special case to check if the server allows range requests * before really starting to get data in the buffer creation * loops. */ - if (!src->got_headers && GST_STATE (src) != GST_STATE_NULL) { + if (!src->got_headers && GST_STATE (src) >= GST_STATE_PAUSED) { g_mutex_lock (&src->mutex); while (!src->got_headers && !src->interrupted && ret == GST_FLOW_OK) { if ((src->msg && src->msg->method != SOUP_METHOD_HEAD) && @@ -1416,6 +1415,15 @@ gst_soup_http_src_is_seekable (GstBaseSrc * bsrc) g_mutex_unlock (&src->mutex); } +} + +static gboolean +gst_soup_http_src_is_seekable (GstBaseSrc * bsrc) +{ + GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (bsrc); + + gst_soup_http_src_check_seekable (src); + return src->seekable; } @@ -1434,7 +1442,11 @@ gst_soup_http_src_do_seek (GstBaseSrc * bsrc, GstSegment * segment) return TRUE; } - if (!src->seekable) { + gst_soup_http_src_check_seekable (src); + + /* If we have no headers we don't know yet if it is seekable or not. + * Store the start position and error out later if it isn't */ + if (src->got_headers && !src->seekable) { GST_WARNING_OBJECT (src, "Not seekable"); return FALSE; } |