From a9e2776074042fb1efc99f7d53d4e122d2a44f62 Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Tue, 10 Sep 2019 00:28:45 +0200 Subject: [PATCH] deviceprovider: set the bus to non-flushing before calling klass->start Not posting DEVICE_ADDED messages while a device provider is being started makes things awkward for applications, as they have to call get_devices() after starting the monitor. This requires redundant code on the application side, and as far as I understand also could cause race conditions, when a device gets added between the calls to gst_device_monitor_start() and gst_device_monitor_get_devices(), causing the application to "see" the same device twice. --- gst/gstdeviceprovider.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst/gstdeviceprovider.c b/gst/gstdeviceprovider.c index 434b429..8d89326 100644 --- a/gst/gstdeviceprovider.c +++ b/gst/gstdeviceprovider.c @@ -457,12 +457,15 @@ gst_device_provider_start (GstDeviceProvider * provider) goto started; } + gst_bus_set_flushing (provider->priv->bus, FALSE); + if (klass->start) ret = klass->start (provider); if (ret) { provider->priv->started_count++; - gst_bus_set_flushing (provider->priv->bus, FALSE); + } else if (provider->priv->started_count == 0) { + gst_bus_set_flushing (provider->priv->bus, TRUE); } started: -- 2.7.4