summary refs log tree commit diff
path: root/src/voip/CallDevices.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/voip/CallDevices.cpp')
-rw-r--r--src/voip/CallDevices.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/voip/CallDevices.cpp b/src/voip/CallDevices.cpp
index e47b5960..ee9a7f43 100644
--- a/src/voip/CallDevices.cpp
+++ b/src/voip/CallDevices.cpp
@@ -248,10 +248,11 @@ tokenise(std::string_view str, char delim)
 }
 }
 
+static GstDeviceMonitor *monitor = nullptr;
+
 void
 CallDevices::init()
 {
-    static GstDeviceMonitor *monitor = nullptr;
     if (!monitor) {
         monitor       = gst_device_monitor_new();
         GstCaps *caps = gst_caps_new_empty_simple("audio/x-raw");
@@ -273,6 +274,16 @@ CallDevices::init()
     }
 }
 
+void
+CallDevices::deinit()
+{
+    if (monitor) {
+        gst_device_monitor_stop(monitor);
+        g_free(monitor);
+        monitor = nullptr;
+    }
+}
+
 bool
 CallDevices::haveMic() const
 {