mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Nvidia: use default p4 preset instead of p5, might fix frame issues
This commit is contained in:
@@ -180,6 +180,8 @@ typedef struct {
|
|||||||
|
|
||||||
unsigned int (*glGetError)(void);
|
unsigned int (*glGetError)(void);
|
||||||
const unsigned char* (*glGetString)(unsigned int name);
|
const unsigned char* (*glGetString)(unsigned int name);
|
||||||
|
void (*glFlush)(void);
|
||||||
|
void (*glFinish)(void);
|
||||||
void (*glClear)(unsigned int mask);
|
void (*glClear)(unsigned int mask);
|
||||||
void (*glClearColor)(float red, float green, float blue, float alpha);
|
void (*glClearColor)(float red, float green, float blue, float alpha);
|
||||||
void (*glGenTextures)(int n, unsigned int *textures);
|
void (*glGenTextures)(int n, unsigned int *textures);
|
||||||
|
|||||||
@@ -349,6 +349,8 @@ void cleanup_socket(gsr_kms_client *self, bool kill_server) {
|
|||||||
|
|
||||||
if(kill_server && self->kms_server_pid != -1) {
|
if(kill_server && self->kms_server_pid != -1) {
|
||||||
kill(self->kms_server_pid, SIGKILL);
|
kill(self->kms_server_pid, SIGKILL);
|
||||||
|
//int status;
|
||||||
|
//waitpid(self->kms_server_pid, &status, 0);
|
||||||
self->kms_server_pid = -1;
|
self->kms_server_pid = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -545,6 +545,8 @@ static int gsr_capture_kms_vaapi_capture(gsr_capture *cap, AVFrame *frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cap_kms->params.egl->eglSwapBuffers(cap_kms->params.egl->egl_display, cap_kms->params.egl->egl_surface);
|
cap_kms->params.egl->eglSwapBuffers(cap_kms->params.egl->egl_display, cap_kms->params.egl->egl_surface);
|
||||||
|
//cap_kms->params.egl->glFlush();
|
||||||
|
//cap_kms->params.egl->glFinish();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,6 +445,8 @@ static int gsr_capture_xcomposite_vaapi_capture(gsr_capture *cap, AVFrame *frame
|
|||||||
texture_rotation);
|
texture_rotation);
|
||||||
|
|
||||||
cap_xcomp->params.egl->eglSwapBuffers(cap_xcomp->params.egl->egl_display, cap_xcomp->params.egl->egl_surface);
|
cap_xcomp->params.egl->eglSwapBuffers(cap_xcomp->params.egl->egl_display, cap_xcomp->params.egl->egl_surface);
|
||||||
|
//cap_xcomp->params.egl->glFlush();
|
||||||
|
//cap_xcomp->params.egl->glFinish();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -363,6 +363,8 @@ static bool gsr_egl_load_gl(gsr_egl *self, void *library) {
|
|||||||
dlsym_assign required_dlsym[] = {
|
dlsym_assign required_dlsym[] = {
|
||||||
{ (void**)&self->glGetError, "glGetError" },
|
{ (void**)&self->glGetError, "glGetError" },
|
||||||
{ (void**)&self->glGetString, "glGetString" },
|
{ (void**)&self->glGetString, "glGetString" },
|
||||||
|
{ (void**)&self->glFlush, "glFlush" },
|
||||||
|
{ (void**)&self->glFinish, "glFinish" },
|
||||||
{ (void**)&self->glClear, "glClear" },
|
{ (void**)&self->glClear, "glClear" },
|
||||||
{ (void**)&self->glClearColor, "glClearColor" },
|
{ (void**)&self->glClearColor, "glClearColor" },
|
||||||
{ (void**)&self->glGenTextures, "glGenTextures" },
|
{ (void**)&self->glGenTextures, "glGenTextures" },
|
||||||
|
|||||||
@@ -598,6 +598,7 @@ static AVFrame* create_audio_frame(AVCodecContext *audio_codec_context) {
|
|||||||
static void open_video(AVCodecContext *codec_context, VideoQuality video_quality, bool very_old_gpu, gsr_gpu_vendor vendor, PixelFormat pixel_format) {
|
static void open_video(AVCodecContext *codec_context, VideoQuality video_quality, bool very_old_gpu, gsr_gpu_vendor vendor, PixelFormat pixel_format) {
|
||||||
AVDictionary *options = nullptr;
|
AVDictionary *options = nullptr;
|
||||||
if(vendor == GSR_GPU_VENDOR_NVIDIA) {
|
if(vendor == GSR_GPU_VENDOR_NVIDIA) {
|
||||||
|
#if 0
|
||||||
bool supports_p4 = false;
|
bool supports_p4 = false;
|
||||||
bool supports_p5 = false;
|
bool supports_p5 = false;
|
||||||
|
|
||||||
@@ -610,6 +611,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
|
|||||||
supports_p5 = true;
|
supports_p5 = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(codec_context->codec_id == AV_CODEC_ID_AV1) {
|
if(codec_context->codec_id == AV_CODEC_ID_AV1) {
|
||||||
switch(video_quality) {
|
switch(video_quality) {
|
||||||
@@ -657,7 +659,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
if(!supports_p4 && !supports_p5)
|
if(!supports_p4 && !supports_p5)
|
||||||
fprintf(stderr, "Info: your ffmpeg version is outdated. It's recommended that you use the flatpak version of gpu-screen-recorder version instead, which you can find at https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder\n");
|
fprintf(stderr, "Info: your ffmpeg version is outdated. It's recommended that you use the flatpak version of gpu-screen-recorder version instead, which you can find at https://flathub.org/apps/details/com.dec05eba.gpu_screen_recorder\n");
|
||||||
|
|
||||||
@@ -680,6 +682,7 @@ static void open_video(AVCodecContext *codec_context, VideoQuality video_quality
|
|||||||
av_dict_set(&options, "preset", supports_p4 ? "p4" : "medium", 0);
|
av_dict_set(&options, "preset", supports_p4 ? "p4" : "medium", 0);
|
||||||
else
|
else
|
||||||
av_dict_set(&options, "preset", supports_p5 ? "p5" : "slow", 0);
|
av_dict_set(&options, "preset", supports_p5 ? "p5" : "slow", 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
av_dict_set(&options, "tune", "hq", 0);
|
av_dict_set(&options, "tune", "hq", 0);
|
||||||
av_dict_set(&options, "rc", "constqp", 0);
|
av_dict_set(&options, "rc", "constqp", 0);
|
||||||
@@ -1387,6 +1390,9 @@ int main(int argc, char **argv) {
|
|||||||
signal(SIGUSR1, save_replay_handler);
|
signal(SIGUSR1, save_replay_handler);
|
||||||
signal(SIGUSR2, toggle_pause_handler);
|
signal(SIGUSR2, toggle_pause_handler);
|
||||||
|
|
||||||
|
// Stop nvidia driver from buffering frames
|
||||||
|
setenv("__GL_MaxFramesAllowed", "1", true);
|
||||||
|
|
||||||
if(argc <= 1)
|
if(argc <= 1)
|
||||||
usage_full();
|
usage_full();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user