mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 23:11:18 +12:00
Correct mistakes in CameraManager::Open
and CameraManager::Close
This commit is contained in:
parent
154eacd85c
commit
062ac500e4
1 changed files with 12 additions and 10 deletions
|
@ -56,21 +56,23 @@ bool CameraManager::Open(bool weak)
|
||||||
m_stream = stream;
|
m_stream = stream;
|
||||||
m_captureThread = std::thread(&CameraManager::CaptureWorker, this);
|
m_captureThread = std::thread(&CameraManager::CaptureWorker, this);
|
||||||
}
|
}
|
||||||
else if (!weak)
|
if (!weak)
|
||||||
m_refCount += 1;
|
m_refCount += 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void CameraManager::Close()
|
void CameraManager::Close()
|
||||||
{
|
{
|
||||||
std::scoped_lock lock(m_mutex);
|
{
|
||||||
if (m_refCount == 0)
|
std::scoped_lock lock(m_mutex);
|
||||||
return;
|
if (m_refCount == 0)
|
||||||
m_refCount -= 1;
|
return;
|
||||||
if (m_refCount != 0)
|
m_refCount -= 1;
|
||||||
return;
|
if (m_refCount != 0)
|
||||||
Cap_closeStream(m_ctx, *m_stream);
|
return;
|
||||||
m_stream = std::nullopt;
|
Cap_closeStream(m_ctx, *m_stream);
|
||||||
m_capturing = false;
|
m_stream = std::nullopt;
|
||||||
|
m_capturing = false;
|
||||||
|
}
|
||||||
m_captureThread.join();
|
m_captureThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue