Browse Source

refactor: Remove extra checks in [un]subscribe

pull/4495/head
Diadlo 8 years ago
parent
commit
60dc4b34a4
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
  1. 21
      src/video/camerasource.cpp

21
src/video/camerasource.cpp

@ -210,10 +210,7 @@ void CameraSource::subscribe() @@ -210,10 +210,7 @@ void CameraSource::subscribe()
{
QWriteLocker locker{&streamMutex};
if (_isNone) {
++subscriptions;
}
++subscriptions;
openDevice();
}
@ -221,22 +218,10 @@ void CameraSource::unsubscribe() @@ -221,22 +218,10 @@ void CameraSource::unsubscribe()
{
QWriteLocker locker{&streamMutex};
if (_isNone) {
--subscriptions;
return;
}
if (!device) {
qWarning() << "Unsubscribing with zero subscriber";
return;
}
if (subscriptions - 1 == 0) {
--subscriptions;
if (subscriptions == 0) {
closeDevice();
} else {
device->close();
}
subscriptions--;
}
/**

Loading…
Cancel
Save