Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gstreamer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Drake <drake@endlessm.com>2019-01-14 11:22:16 +0300
committerTim-Philipp Müller <tim@centricular.com>2019-05-02 10:31:25 +0300
commit70599dc3d874879201131e1b95afebd2258b1e9d (patch)
tree4406087bf5b1f3008b353f1a09deea516c8506a5
parentf37190e6d1e3e96ae50c036c8afd8c9273ae950b (diff)
deviceprovider: fix counting number of times started
GstDeviceProvider has a started_count private variable counter, and the gst_device_provider_start() documentation emphasizes the importance of balancing the start and stop calls. However, when starting a provider that is already started, the current code will never increment the counter more than once. So you start it twice, but it will have start_count 1, which is the maximum value it will ever see. Then when you stop it twice, on the 2nd stop, after decrementing the counter in gst_device_provider_stop(): else if (provider->priv->started_count < 1) { g_critical ("Trying to stop a GstDeviceProvider %s which is already stopped", GST_OBJECT_NAME (provider)); and the program is killed. Fix this by incrementing the counter when starting a device provider that was already started.
-rw-r--r--gst/gstdeviceprovider.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gst/gstdeviceprovider.c b/gst/gstdeviceprovider.c
index 83bb54b931..96a08047d7 100644
--- a/gst/gstdeviceprovider.c
+++ b/gst/gstdeviceprovider.c
@@ -444,6 +444,7 @@ gst_device_provider_start (GstDeviceProvider * provider)
g_mutex_lock (&provider->priv->start_lock);
if (provider->priv->started_count > 0) {
+ provider->priv->started_count++;
ret = TRUE;
goto started;
}