Keep nvidia-failed status permanently, so later clients don't try it in vain

video
Lauri Kasanen 4 years ago
parent ac56f5566b
commit 44a194886d

@ -41,6 +41,8 @@ static LogWriter vlog("x264");
static const PixelFormat pfRGBX(32, 24, false, true, 255, 255, 255, 0, 8, 16); static const PixelFormat pfRGBX(32, 24, false, true, 255, 255, 255, 0, 8, 16);
static const PixelFormat pfBGRX(32, 24, false, true, 255, 255, 255, 16, 8, 0); static const PixelFormat pfBGRX(32, 24, false, true, 255, 255, 255, 16, 8, 0);
bool TightX264Encoder::skip_nvidia = false;
TightX264Encoder::TightX264Encoder(SConnection* conn, EncCache *cache_, uint8_t cacheType_) : TightX264Encoder::TightX264Encoder(SConnection* conn, EncCache *cache_, uint8_t cacheType_) :
Encoder(conn, encodingTight, (EncoderFlags)(EncoderUseNativePF | EncoderLossy), -1), Encoder(conn, encodingTight, (EncoderFlags)(EncoderUseNativePF | EncoderLossy), -1),
keyframe(true), enc(NULL), params(NULL), mux(NULL), muxstate(NULL), framectr(0), keyframe(true), enc(NULL), params(NULL), mux(NULL), muxstate(NULL), framectr(0),
@ -485,11 +487,13 @@ bool TightX264Encoder::tryInit(const PixelBuffer* pb) {
w = pb->width(); w = pb->width();
h = pb->height(); h = pb->height();
if (nvidia_init(w, h, rfb::Server::x264Bitrate, if (skip_nvidia || nvidia_init(w, h, rfb::Server::x264Bitrate,
rfb::Server::frameRate) != 0) { rfb::Server::frameRate) != 0) {
if (!skip_nvidia)
vlog.error("nvidia init failed, falling back to x264"); vlog.error("nvidia init failed, falling back to x264");
using_nvidia = false; using_nvidia = false;
nvidia_init_done = true; nvidia_init_done = true;
skip_nvidia = true;
myw = w; myw = w;
myh = h; myh = h;
return true; return true;

@ -66,6 +66,7 @@ namespace rfb {
bool nvidia_init_done; bool nvidia_init_done;
bool using_nvidia; bool using_nvidia;
static bool skip_nvidia;
EncCache *encCache; EncCache *encCache;
uint8_t cacheType; uint8_t cacheType;

Loading…
Cancel
Save