mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix running proxied video if it gets pushed to the main thread
This commit is contained in:
parent
a2dc6557e3
commit
e7028e4b29
1
CHANGES
1
CHANGES
|
@ -54,6 +54,7 @@ Other fixes:
|
|||
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
||||
- Qt: Fix a race condition in the frame inspector
|
||||
- Qt: Load/save bytes from memory viewer in the order visible (fixes mgba.io/i/1900)
|
||||
- Qt: Fix running proxied video if it gets pushed to the main thread
|
||||
- SM83: Simplify register pair access on big endian
|
||||
- SM83: Disassemble STOP as one byte
|
||||
Misc:
|
||||
|
|
|
@ -58,11 +58,16 @@ void VideoProxy::deinit() {
|
|||
|
||||
bool VideoProxy::writeData(const void* data, size_t length) {
|
||||
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
||||
emit dataAvailable();
|
||||
m_mutex.lock();
|
||||
m_toThreadCond.wakeAll();
|
||||
m_fromThreadCond.wait(&m_mutex);
|
||||
m_mutex.unlock();
|
||||
if (QThread::currentThread() == thread()) {
|
||||
// We're on the main thread
|
||||
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||
} else {
|
||||
emit dataAvailable();
|
||||
m_mutex.lock();
|
||||
m_toThreadCond.wakeAll();
|
||||
m_fromThreadCond.wait(&m_mutex);
|
||||
m_mutex.unlock();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -112,9 +117,14 @@ void VideoProxy::unlock() {
|
|||
void VideoProxy::wait() {
|
||||
m_mutex.lock();
|
||||
while (RingFIFOSize(&m_dirtyQueue)) {
|
||||
emit dataAvailable();
|
||||
m_toThreadCond.wakeAll();
|
||||
m_fromThreadCond.wait(&m_mutex, 1);
|
||||
if (QThread::currentThread() == thread()) {
|
||||
// We're on the main thread
|
||||
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||
} else {
|
||||
emit dataAvailable();
|
||||
m_toThreadCond.wakeAll();
|
||||
m_fromThreadCond.wait(&m_mutex, 1);
|
||||
}
|
||||
}
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue