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.
This commit is contained in:
Mathieu Duponchelle 2019-09-10 00:28:45 +02:00 committed by Mathieu Duponchelle
parent 9cf764b2ec
commit a9e2776074

View file

@ -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: