diff --git a/CHANGES b/CHANGES index 835db7c64..f47651e75 100644 --- a/CHANGES +++ b/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: diff --git a/src/platform/qt/VideoProxy.cpp b/src/platform/qt/VideoProxy.cpp index 8a89ea533..3e8549d69 100644 --- a/src/platform/qt/VideoProxy.cpp +++ b/src/platform/qt/VideoProxy.cpp @@ -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(); }