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:
|
Other fixes:
|
||||||
- CMake: Fix build with downstream minizip that exports incompatible symbols
|
- CMake: Fix build with downstream minizip that exports incompatible symbols
|
||||||
- Debugger: Close trace log when done tracing
|
- 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)
|
0.8.4: (2020-10-29)
|
||||||
Emulation fixes:
|
Emulation fixes:
|
||||||
|
|
|
@ -58,11 +58,16 @@ void VideoProxy::deinit() {
|
||||||
|
|
||||||
bool VideoProxy::writeData(const void* data, size_t length) {
|
bool VideoProxy::writeData(const void* data, size_t length) {
|
||||||
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
while (!RingFIFOWrite(&m_dirtyQueue, data, length)) {
|
||||||
emit dataAvailable();
|
if (QThread::currentThread() == thread()) {
|
||||||
m_mutex.lock();
|
// We're on the main thread
|
||||||
m_toThreadCond.wakeAll();
|
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||||
m_fromThreadCond.wait(&m_mutex);
|
} else {
|
||||||
m_mutex.unlock();
|
emit dataAvailable();
|
||||||
|
m_mutex.lock();
|
||||||
|
m_toThreadCond.wakeAll();
|
||||||
|
m_fromThreadCond.wait(&m_mutex);
|
||||||
|
m_mutex.unlock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -112,9 +117,14 @@ void VideoProxy::unlock() {
|
||||||
void VideoProxy::wait() {
|
void VideoProxy::wait() {
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
while (RingFIFOSize(&m_dirtyQueue)) {
|
while (RingFIFOSize(&m_dirtyQueue)) {
|
||||||
emit dataAvailable();
|
if (QThread::currentThread() == thread()) {
|
||||||
m_toThreadCond.wakeAll();
|
// We're on the main thread
|
||||||
m_fromThreadCond.wait(&m_mutex, 1);
|
mVideoLoggerRendererRun(&m_logger.d, false);
|
||||||
|
} else {
|
||||||
|
emit dataAvailable();
|
||||||
|
m_toThreadCond.wakeAll();
|
||||||
|
m_fromThreadCond.wait(&m_mutex, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue