mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 15:31:18 +12:00
Only convert upon successful capture
This commit is contained in:
parent
277c3efacd
commit
6093ee03a5
1 changed files with 8 additions and 5 deletions
|
@ -158,14 +158,17 @@ namespace camera
|
||||||
{
|
{
|
||||||
if (!m_opened)
|
if (!m_opened)
|
||||||
{
|
{
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(2));
|
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Cap_captureFrame(m_capCtx, stream, rgbBuffer.get(), rgbBufferSize);
|
auto res = Cap_captureFrame(m_capCtx, stream, rgbBuffer.get(), rgbBufferSize);
|
||||||
|
if (res == CAPRESULT_OK)
|
||||||
|
{
|
||||||
std::scoped_lock lock(m_callbackMutex);
|
std::scoped_lock lock(m_callbackMutex);
|
||||||
Rgb2Nv12(rgbBuffer.get(), g_width, g_height, m_capNv12Buffer.get(), g_pitch);
|
Rgb2Nv12(rgbBuffer.get(), g_width, g_height, m_capNv12Buffer.get(), g_pitch);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Cap_closeStream(m_capCtx, stream);
|
Cap_closeStream(m_capCtx, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ namespace camera
|
||||||
return CAMError::NotReady;
|
return CAMError::NotReady;
|
||||||
if (!m_targetSurfaceQueue.Push(surface))
|
if (!m_targetSurfaceQueue.Push(surface))
|
||||||
return CAMError::SurfaceQueueFull;
|
return CAMError::SurfaceQueueFull;
|
||||||
cemuLog_logDebug(LogType::Force, "camera: surface submitted");
|
cemuLog_logDebug(LogType::Force, "camera: surface {} submitted", surface->surfacePtr);
|
||||||
return CAMError::Success;
|
return CAMError::Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue