mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
souphttpsrc: Post context message after setting up the context from the source's thread
This simplifies the code and especially the locking a bit, and makes sure we only export the session after it is fully set up. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1603>
This commit is contained in:
parent
47bfa71530
commit
1db95a61c0
1 changed files with 16 additions and 21 deletions
|
@ -1031,27 +1031,6 @@ thread_func (gpointer user_data)
|
||||||
_soup_session_add_feature_by_type (session->session,
|
_soup_session_add_feature_by_type (session->session,
|
||||||
_soup_cookie_jar_get_type ());
|
_soup_cookie_jar_get_type ());
|
||||||
|
|
||||||
if (src->session_is_shared) {
|
|
||||||
GstContext *context;
|
|
||||||
GstMessage *message;
|
|
||||||
GstStructure *s;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (session, "Sharing session %p", session->session);
|
|
||||||
|
|
||||||
context = gst_context_new (GST_SOUP_SESSION_CONTEXT, TRUE);
|
|
||||||
s = gst_context_writable_structure (context);
|
|
||||||
gst_structure_set (s, "session", GST_TYPE_SOUP_SESSION, session, NULL);
|
|
||||||
|
|
||||||
/* during this time the src is locked by the parent thread,
|
|
||||||
* which is waiting, so this is safe to do
|
|
||||||
*/
|
|
||||||
GST_OBJECT_UNLOCK (src);
|
|
||||||
gst_element_set_context (GST_ELEMENT_CAST (src), context);
|
|
||||||
message = gst_message_new_have_context (GST_OBJECT_CAST (src), context);
|
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (src), message);
|
|
||||||
GST_OBJECT_LOCK (src);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* soup2: connect the authenticate handler for the src that spawned the
|
/* soup2: connect the authenticate handler for the src that spawned the
|
||||||
* session (i.e. the first owner); other users of this session will connect
|
* session (i.e. the first owner); other users of this session will connect
|
||||||
* their own after fetching the external session; the callback will handle
|
* their own after fetching the external session; the callback will handle
|
||||||
|
@ -1199,6 +1178,22 @@ gst_soup_http_src_session_open (GstSoupHTTPSrc * src)
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
|
||||||
|
if (src->session_is_shared) {
|
||||||
|
GstContext *context;
|
||||||
|
GstMessage *message;
|
||||||
|
GstStructure *s;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (src->session, "Sharing session %p", src->session);
|
||||||
|
|
||||||
|
context = gst_context_new (GST_SOUP_SESSION_CONTEXT, TRUE);
|
||||||
|
s = gst_context_writable_structure (context);
|
||||||
|
gst_structure_set (s, "session", GST_TYPE_SOUP_SESSION, src->session, NULL);
|
||||||
|
|
||||||
|
gst_element_set_context (GST_ELEMENT_CAST (src), context);
|
||||||
|
message = gst_message_new_have_context (GST_OBJECT_CAST (src), context);
|
||||||
|
gst_element_post_message (GST_ELEMENT_CAST (src), message);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
|
|
Loading…
Reference in a new issue