From 2da169af162c52b185ace097a5f14061719c20f4 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Thu, 17 Oct 2019 13:24:59 -0400
Subject: [PATCH] videoview: don't restart the same device through the context
 menu

-  once the switch video input device option is triggered,
   only change if the current device is not the currently
   used device

Change-Id: I8b8c2a9a51981c5a8c2b4597d8b8f298d4397259
---
 videoview.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/videoview.cpp b/videoview.cpp
index 00f224a..0e0b2d4 100644
--- a/videoview.cpp
+++ b/videoview.cpp
@@ -230,6 +230,9 @@ VideoView::showContextMenu(const QPoint& position)
         connect(deviceAction, &QAction::triggered,
             [this, deviceName]() {
                 auto device = deviceName.toStdString();
+                if (LRCInstance::avModel().getCurrentVideoCaptureDevice() == device) {
+                    return;
+                }
                 resetPreview();
                 LRCInstance::avModel().switchInputTo(device);
                 LRCInstance::avModel().setCurrentVideoCaptureDevice(device);
-- 
GitLab