mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-14 23:47:09 +00:00
Removed unused NullThreadedVsyncSource
This commit is contained in:
parent
e3d51fd7f7
commit
8e3e19a7f7
4 changed files with 2 additions and 74 deletions
|
@ -212,15 +212,13 @@ ffmpeg {
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
streaming/video/ffmpeg.cpp \
|
streaming/video/ffmpeg.cpp \
|
||||||
streaming/video/ffmpeg-renderers/sdlvid.cpp \
|
streaming/video/ffmpeg-renderers/sdlvid.cpp \
|
||||||
streaming/video/ffmpeg-renderers/pacer/pacer.cpp \
|
streaming/video/ffmpeg-renderers/pacer/pacer.cpp
|
||||||
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.cpp
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
streaming/video/ffmpeg.h \
|
streaming/video/ffmpeg.h \
|
||||||
streaming/video/ffmpeg-renderers/renderer.h \
|
streaming/video/ffmpeg-renderers/renderer.h \
|
||||||
streaming/video/ffmpeg-renderers/sdlvid.h \
|
streaming/video/ffmpeg-renderers/sdlvid.h \
|
||||||
streaming/video/ffmpeg-renderers/pacer/pacer.h \
|
streaming/video/ffmpeg-renderers/pacer/pacer.h
|
||||||
streaming/video/ffmpeg-renderers/pacer/nullthreadedvsyncsource.h
|
|
||||||
}
|
}
|
||||||
libva {
|
libva {
|
||||||
message(VAAPI renderer selected)
|
message(VAAPI renderer selected)
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
#include "nullthreadedvsyncsource.h"
|
|
||||||
|
|
||||||
NullThreadedVsyncSource::NullThreadedVsyncSource(Pacer* pacer) :
|
|
||||||
m_Pacer(pacer),
|
|
||||||
m_Thread(nullptr)
|
|
||||||
{
|
|
||||||
SDL_AtomicSet(&m_Stopping, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
NullThreadedVsyncSource::~NullThreadedVsyncSource()
|
|
||||||
{
|
|
||||||
if (m_Thread != nullptr) {
|
|
||||||
SDL_AtomicSet(&m_Stopping, 1);
|
|
||||||
SDL_WaitThread(m_Thread, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool NullThreadedVsyncSource::initialize(SDL_Window*, int displayFps)
|
|
||||||
{
|
|
||||||
m_DisplayFps = displayFps;
|
|
||||||
m_Thread = SDL_CreateThread(vsyncThread, "NullVsync", this);
|
|
||||||
if (m_Thread == nullptr) {
|
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
|
||||||
"Unable to create DX V-sync thread: %s",
|
|
||||||
SDL_GetError());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int NullThreadedVsyncSource::vsyncThread(void* context)
|
|
||||||
{
|
|
||||||
NullThreadedVsyncSource* me = reinterpret_cast<NullThreadedVsyncSource*>(context);
|
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 9)
|
|
||||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_TIME_CRITICAL);
|
|
||||||
#else
|
|
||||||
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (SDL_AtomicGet(&me->m_Stopping) == 0) {
|
|
||||||
me->m_Pacer->vsyncCallback(1000 / me->m_DisplayFps);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "pacer.h"
|
|
||||||
|
|
||||||
class NullThreadedVsyncSource : public IVsyncSource
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NullThreadedVsyncSource(Pacer* pacer);
|
|
||||||
|
|
||||||
virtual ~NullThreadedVsyncSource();
|
|
||||||
|
|
||||||
virtual bool initialize(SDL_Window* window, int displayFps);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static int vsyncThread(void* context);
|
|
||||||
|
|
||||||
Pacer* m_Pacer;
|
|
||||||
SDL_Thread* m_Thread;
|
|
||||||
SDL_atomic_t m_Stopping;
|
|
||||||
int m_DisplayFps;
|
|
||||||
};
|
|
|
@ -1,8 +1,6 @@
|
||||||
#include "pacer.h"
|
#include "pacer.h"
|
||||||
#include "streaming/streamutils.h"
|
#include "streaming/streamutils.h"
|
||||||
|
|
||||||
#include "nullthreadedvsyncsource.h"
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
Loading…
Reference in a new issue