mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor: Remove extra checks in [un]subscribe
This commit is contained in:
parent
a22694c9e8
commit
60dc4b34a4
@ -210,10 +210,7 @@ void CameraSource::subscribe()
|
||||
{
|
||||
QWriteLocker locker{&streamMutex};
|
||||
|
||||
if (_isNone) {
|
||||
++subscriptions;
|
||||
}
|
||||
|
||||
++subscriptions;
|
||||
openDevice();
|
||||
}
|
||||
|
||||
@ -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…
x
Reference in New Issue
Block a user