Skip to content
Permalink
Browse files
[Flatpak SDK] Backport GStreamer device monitor patch
https://bugs.webkit.org/show_bug.cgi?id=218021

Patch by Philippe Normand <pnormand@igalia.com> on 2020-10-22
Reviewed by Adrian Perez de Castro.

Backport of https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/679 to be shipped in 1.20.
This is needed to prevent false-positive critical warnings on the bots. See #217959.

* buildstream/elements/sdk/gstreamer.bst:
* buildstream/patches/gstreamer-0001-devicemonitor-Stop-only-the-already-started-provider.patch: Added.

Canonical link: https://commits.webkit.org/230791@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268863 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
philn authored and webkit-commit-queue committed Oct 22, 2020
1 parent 52816e8 commit 74ef25ee6625995a91269278a2642975810d2589
Showing 3 changed files with 135 additions and 0 deletions.
@@ -1,3 +1,16 @@
2020-10-22 Philippe Normand <pnormand@igalia.com>

[Flatpak SDK] Backport GStreamer device monitor patch
https://bugs.webkit.org/show_bug.cgi?id=218021

Reviewed by Adrian Perez de Castro.

Backport of https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/679 to be shipped in 1.20.
This is needed to prevent false-positive critical warnings on the bots. See #217959.

* buildstream/elements/sdk/gstreamer.bst:
* buildstream/patches/gstreamer-0001-devicemonitor-Stop-only-the-already-started-provider.patch: Added.

2020-10-22 Carlos Garcia Campos <cgarcia@igalia.com>

Unreviewed. Update W3C WebDriver imported tests.
@@ -3,6 +3,10 @@ sources:
- kind: tar
url: gst_downloads:gstreamer/gstreamer-1.18.0.tar.xz
ref: 0ff09245b06c0aeb5d9a156edcab088a7e8213a0bf9c84a1ff0318f9c00c7805
# Backport of https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/679 to be shipped in 1.20.
- kind: patch
path: patches/gstreamer-0001-devicemonitor-Stop-only-the-already-started-provider.patch

build-depends:
- freedesktop-sdk.bst:components/gobject-introspection.bst
- freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
@@ -0,0 +1,118 @@
From c66d393e5980aa36e6f2d53cacec6887476bc5e4 Mon Sep 17 00:00:00 2001
From: Philippe Normand <philn@igalia.com>
Date: Wed, 21 Oct 2020 09:43:43 +0100
Subject: [PATCH] devicemonitor: Stop only the already started providers

If a device provider fails to start (for instance the pulseaudio provider unable
to connect to the PulseAudio daemon) then the monitor should not keep track of
it in its `started` providers list. Otherwise a false positive critical warning
would be raised.

This patch also switches the started_count type from bool to int, for
consistency. This is a counter, after all.

API: gst_device_provider_is_started
---
gst/gstdevicemonitor.c | 3 ++-
gst/gstdeviceprovider.c | 25 ++++++++++++++++++++++++-
gst/gstdeviceprovider.h | 3 +++
tests/check/gst/gstdevice.c | 2 ++
4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c
index 43752e15d..fae2f61f5 100644
--- a/gst/gstdevicemonitor.c
+++ b/gst/gstdevicemonitor.c
@@ -571,7 +571,8 @@ gst_device_monitor_stop (GstDeviceMonitor * monitor)
GstDeviceProvider *provider =
g_ptr_array_index (monitor->priv->providers, i);

- started = g_list_prepend (started, gst_object_ref (provider));
+ if (gst_device_provider_is_started (provider))
+ started = g_list_prepend (started, gst_object_ref (provider));
}
GST_OBJECT_UNLOCK (monitor);

diff --git a/gst/gstdeviceprovider.c b/gst/gstdeviceprovider.c
index 4d159fe6c..547b7a174 100644
--- a/gst/gstdeviceprovider.c
+++ b/gst/gstdeviceprovider.c
@@ -55,7 +55,7 @@ struct _GstDeviceProviderPrivate

GMutex start_lock;

- gboolean started_count;
+ gint started_count;

GList *hidden_providers;
};
@@ -165,6 +165,8 @@ gst_device_provider_init (GstDeviceProvider * provider)

g_mutex_init (&provider->priv->start_lock);

+ provider->priv->started_count = 0;
+
provider->priv->bus = gst_bus_new ();
gst_bus_set_flushing (provider->priv->bus, TRUE);
}
@@ -854,3 +856,24 @@ gst_device_provider_device_changed (GstDeviceProvider * provider,
gst_bus_post (provider->priv->bus, message);
gst_object_unparent (GST_OBJECT (changed_device));
}
+
+/**
+ * gst_device_provider_is_started:
+ * @provider: a #GstDeviceProvider
+ *
+ * This function can be used to know if the @provider was successfully started.
+ *
+ * Since: 1.20
+ */
+gboolean
+gst_device_provider_is_started (GstDeviceProvider * provider)
+{
+ gboolean started = FALSE;
+
+ g_return_val_if_fail (GST_IS_DEVICE_PROVIDER (provider), FALSE);
+
+ g_mutex_lock (&provider->priv->start_lock);
+ started = provider->priv->started_count > 0;
+ g_mutex_unlock (&provider->priv->start_lock);
+ return started;
+}
diff --git a/gst/gstdeviceprovider.h b/gst/gstdeviceprovider.h
index 56ad6209a..cafe37e1c 100644
--- a/gst/gstdeviceprovider.h
+++ b/gst/gstdeviceprovider.h
@@ -139,6 +139,9 @@ GST_API
const gchar * gst_device_provider_get_metadata (GstDeviceProvider * provider,
const gchar * key);

+GST_API
+gboolean gst_device_provider_is_started (GstDeviceProvider * provider);
+
/* device provider class meta data */

GST_API
diff --git a/tests/check/gst/gstdevice.c b/tests/check/gst/gstdevice.c
index 70e186ac3..8d4723608 100644
--- a/tests/check/gst/gstdevice.c
+++ b/tests/check/gst/gstdevice.c
@@ -244,12 +244,14 @@ GST_START_TEST (test_device_provider)
g_list_free_full (devs, (GDestroyNotify) gst_object_unref);

fail_if (gst_device_provider_can_monitor (dp));
+ fail_if (gst_device_provider_is_started (dp));
fail_unless (gst_device_provider_start (dp));

bus = gst_device_provider_get_bus (dp);
fail_unless (GST_IS_BUS (bus));
gst_object_unref (bus);

+ fail_unless (gst_device_provider_is_started (dp));
gst_device_provider_stop (dp);

gst_object_unref (dp);
--
2.28.0

0 comments on commit 74ef25e

Please sign in to comment.