mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 05:21:25 +12:00
test
This commit is contained in:
parent
1a12dcf79b
commit
46281ece4c
2 changed files with 14 additions and 5 deletions
|
@ -630,8 +630,12 @@ void camera_settings_dialog::handle_sdl_settings_change(const QVariant& item_dat
|
||||||
{
|
{
|
||||||
// It was observed that connecting sendVideoFrame directly can soft-lock the software.
|
// It was observed that connecting sendVideoFrame directly can soft-lock the software.
|
||||||
// So let's just create the video frame here and call it manually.
|
// So let's just create the video frame here and call it manually.
|
||||||
|
std::unique_lock lock(m_sdl_image_mutex, std::defer_lock);
|
||||||
|
if (lock.try_lock())
|
||||||
|
{
|
||||||
const QVideoFrame video_frame(m_sdl_image);
|
const QVideoFrame video_frame(m_sdl_image);
|
||||||
m_video_frame_input->sendVideoFrame(video_frame);
|
m_video_frame_input->sendVideoFrame(video_frame);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -674,18 +678,20 @@ void camera_settings_dialog::run_sdl()
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (QT_VERSION_MAJOR >= 6 && QT_VERSION_MINOR >= 8) // TODO: Remove when MacOs is at Qt 6.8+
|
#if (QT_VERSION_MAJOR >= 6 && QT_VERSION_MINOR >= 8) // TODO: Remove when MacOs is at Qt 6.8+
|
||||||
Emu.BlockingCallFromMainThread([this, frame]()
|
|
||||||
{
|
{
|
||||||
// Map image
|
// Map image
|
||||||
const QImage::Format format = SDL_ISPIXELFORMAT_ALPHA(frame->format) ? QImage::Format_RGBA8888 : QImage::Format_RGB888;
|
const QImage::Format format = SDL_ISPIXELFORMAT_ALPHA(frame->format) ? QImage::Format_RGBA8888 : QImage::Format_RGB888;
|
||||||
const QImage image = QImage(reinterpret_cast<const u8*>(frame->pixels), frame->w, frame->h, format);
|
const QImage image = QImage(reinterpret_cast<const u8*>(frame->pixels), frame->w, frame->h, format);
|
||||||
|
|
||||||
// Copy image to prevent memory access violations
|
// Copy image to prevent memory access violations
|
||||||
|
{
|
||||||
|
std::lock_guard lock(m_sdl_image_mutex);
|
||||||
m_sdl_image = image.copy();
|
m_sdl_image = image.copy();
|
||||||
|
}
|
||||||
|
|
||||||
// Notify UI
|
// Notify UI
|
||||||
Q_EMIT sdl_frame_ready();
|
Q_EMIT sdl_frame_ready();
|
||||||
});
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_ReleaseCameraFrame(m_sdl_camera, frame);
|
SDL_ReleaseCameraFrame(m_sdl_camera, frame);
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#endif
|
#endif
|
||||||
#include <QVideoFrame>
|
#include <QVideoFrame>
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
#ifdef HAVE_SDL3
|
#ifdef HAVE_SDL3
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
|
@ -62,6 +64,7 @@ private:
|
||||||
SDL_Camera* m_sdl_camera = nullptr;
|
SDL_Camera* m_sdl_camera = nullptr;
|
||||||
SDL_CameraID m_sdl_camera_id = 0;
|
SDL_CameraID m_sdl_camera_id = 0;
|
||||||
QImage m_sdl_image;
|
QImage m_sdl_image;
|
||||||
|
std::mutex m_sdl_image_mutex;
|
||||||
std::unique_ptr<named_thread<std::function<void()>>> m_sdl_thread;
|
std::unique_ptr<named_thread<std::function<void()>>> m_sdl_thread;
|
||||||
#if (QT_VERSION_MAJOR >= 6 && QT_VERSION_MINOR >= 8) // TODO: Remove when MacOs is at Qt 6.8+
|
#if (QT_VERSION_MAJOR >= 6 && QT_VERSION_MINOR >= 8) // TODO: Remove when MacOs is at Qt 6.8+
|
||||||
std::unique_ptr<QVideoFrameInput> m_video_frame_input;
|
std::unique_ptr<QVideoFrameInput> m_video_frame_input;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue