Commit graph

7 commits

Author SHA1 Message Date
Sebastian Dröge 42f5873eeb souphttpsrc: Don't use the source element after setup from the session thread
The source element might be gone already if the session is shared with
other source elements.

As a consequence, do all logging via the session object instead of using
the source element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1594>
2022-01-28 15:41:54 +02:00
Sebastian Dröge 080d85b19a souphttpsrc: Don't abort all pending operations on the session if shutting down a source with a shared session
Only do it for a non-shared session. Other sources would otherwise get
their requests cancelled unexpectedly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1594>
2022-01-28 15:31:55 +02:00
Sebastian Dröge 499e0acd43 souphttpsrc: Don't set boolean to FALSE right after checking that it is FALSE
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1594>
2022-01-28 15:31:25 +02:00
Sebastian Dröge 165be69017 souphttpsrc: soup_session_new_with_options() can't fail with NULL
So don't check for it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1594>
2022-01-28 15:30:56 +02:00
Daniel Kolesa 0bcefa7350 soup: move libsoup session into its own thread
Starting with libsoup3, there is no attempt to handle thread safety
inside the library, and it was never considered fully safe before
either. Therefore, move all session handling into its own thread.

The libsoup thread has its own context and main loop. When some
request is made or a response needs to be read, an idle source
is created to issue that; the gstreamer thread issuing that waits
for that to be complete. There is a per-src condition variable to
deal with that.

Since the thread/loop needs to be longer-lived than the soup
session itself, a wrapper object is provided to contain them. The
soup session only has a single reference, owned by the wrapper
object.

It is no longer possible to force an external session, since this
does not seem to be used anywhere within gstreamer and would be
tricky to implement; this is because one would not have to provide
just a session, but also the complete thread arrangement made in
the same way as the system currently does internally, in order to
be safe.

Messages are still built gstreamer-side. It is safe to do so until
the message is sent on the session. Headers are also processed on
the gstreamer side, which should likewise be safe.

All requests as well as reads on the libsoup thread are issued
asynchronously. That allows libsoup to schedule things with as
little blocking as possible, and means that concurrent access
to the session is possible, when sharing the session.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/947

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1555>
2022-01-28 08:49:09 +00:00
Philippe Normand c3455def2e soup: Runtime compatibility support for libsoup2 and libsoup3
The src and sink elements no longer link against libsoup. It is now loaded at
runtime. If any version is resident already, it is used. Otherwise we first try
to load libsoup3 and if it's not found we fallback to libsoup2.

For the unit-tests, we now build one version of the test unit file per libsoup
version found. So if both libsoup2 and libsoup3 are available on the host, the
CI will cover them both.

Based on initial patch by Daniel Kolesa <dkolesa@igalia.com> and
Patrick Griffis <pgriffis@igalia.com>.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1044>
2021-10-13 08:32:25 +00:00
Thibault Saunier 5ff769d731 Move files from gst-plugins-good into the "subprojects/gst-plugins-good/" subdir 2021-09-24 16:13:50 -03:00
Renamed from ext/soup/gstsouphttpsrc.c (Browse further)