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
f70185da5f
commit
32fc0dac31
1
CHANGES
1
CHANGES
|
@ -4,6 +4,7 @@ Emulation fixes:
|
|||
Other fixes:
|
||||
- CMake: Fix build with downstream minizip that exports incompatible symbols
|
||||
- Debugger: Close trace log when done tracing
|
||||
- Qt: Fix running proxied video if it gets pushed to the main thread
|
||||
|
||||
0.8.4: (2020-10-29)
|
||||
Emulation fixes:
|
||||
|
|
|
@ -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