mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-04-24 02:29:49 +09:00
Fix nvfbc capture crash on start
This commit is contained in:
@@ -9,7 +9,6 @@ typedef struct _XDisplay Display;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
gsr_egl *egl;
|
|
||||||
const char *display_to_capture; /* if this is "screen", then the entire x11 screen is captured (all displays). A copy is made of this */
|
const char *display_to_capture; /* if this is "screen", then the entire x11 screen is captured (all displays). A copy is made of this */
|
||||||
int fps;
|
int fps;
|
||||||
vec2i pos;
|
vec2i pos;
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ static bool ffmpeg_create_cuda_contexts(gsr_capture_nvfbc *cap_nvfbc, AVCodecCon
|
|||||||
|
|
||||||
static int gsr_capture_nvfbc_start(gsr_capture *cap, AVCodecContext *video_codec_context) {
|
static int gsr_capture_nvfbc_start(gsr_capture *cap, AVCodecContext *video_codec_context) {
|
||||||
gsr_capture_nvfbc *cap_nvfbc = cap->priv;
|
gsr_capture_nvfbc *cap_nvfbc = cap->priv;
|
||||||
if(!gsr_cuda_load(&cap_nvfbc->cuda, cap_nvfbc->params.egl->x11.dpy, cap_nvfbc->params.overclock))
|
if(!gsr_cuda_load(&cap_nvfbc->cuda, cap_nvfbc->params.dpy, cap_nvfbc->params.overclock))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(!gsr_capture_nvfbc_load_library(cap)) {
|
if(!gsr_capture_nvfbc_load_library(cap)) {
|
||||||
@@ -269,8 +269,8 @@ static int gsr_capture_nvfbc_start(gsr_capture *cap, AVCodecContext *video_codec
|
|||||||
goto error_cleanup;
|
goto error_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t tracking_width = XWidthOfScreen(DefaultScreenOfDisplay(cap_nvfbc->params.egl->x11.dpy));
|
uint32_t tracking_width = XWidthOfScreen(DefaultScreenOfDisplay(cap_nvfbc->params.dpy));
|
||||||
uint32_t tracking_height = XHeightOfScreen(DefaultScreenOfDisplay(cap_nvfbc->params.egl->x11.dpy));
|
uint32_t tracking_height = XHeightOfScreen(DefaultScreenOfDisplay(cap_nvfbc->params.dpy));
|
||||||
tracking_type = strcmp(cap_nvfbc->params.display_to_capture, "screen") == 0 ? NVFBC_TRACKING_SCREEN : NVFBC_TRACKING_OUTPUT;
|
tracking_type = strcmp(cap_nvfbc->params.display_to_capture, "screen") == 0 ? NVFBC_TRACKING_SCREEN : NVFBC_TRACKING_OUTPUT;
|
||||||
if(tracking_type == NVFBC_TRACKING_OUTPUT) {
|
if(tracking_type == NVFBC_TRACKING_OUTPUT) {
|
||||||
if(!status_params.bXRandRAvailable) {
|
if(!status_params.bXRandRAvailable) {
|
||||||
|
|||||||
@@ -1380,7 +1380,8 @@ static void list_supported_video_codecs() {
|
|||||||
_exit(2);
|
_exit(2);
|
||||||
|
|
||||||
gsr_egl_unload(&egl);
|
gsr_egl_unload(&egl);
|
||||||
XCloseDisplay(dpy);
|
if(dpy)
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
char card_path[128];
|
char card_path[128];
|
||||||
card_path[0] = '\0';
|
card_path[0] = '\0';
|
||||||
@@ -1494,16 +1495,15 @@ static gsr_capture* create_capture_impl(const char *window_str, const char *scre
|
|||||||
capture_target = "screen";
|
capture_target = "screen";
|
||||||
}
|
}
|
||||||
|
|
||||||
gsr_egl_unload(&egl);
|
|
||||||
|
|
||||||
gsr_capture_nvfbc_params nvfbc_params;
|
gsr_capture_nvfbc_params nvfbc_params;
|
||||||
nvfbc_params.egl->x11.dpy = egl.x11.dpy;
|
nvfbc_params.dpy = egl.x11.dpy;
|
||||||
nvfbc_params.display_to_capture = capture_target;
|
nvfbc_params.display_to_capture = capture_target;
|
||||||
nvfbc_params.fps = fps;
|
nvfbc_params.fps = fps;
|
||||||
nvfbc_params.pos = { 0, 0 };
|
nvfbc_params.pos = { 0, 0 };
|
||||||
nvfbc_params.size = { 0, 0 };
|
nvfbc_params.size = { 0, 0 };
|
||||||
nvfbc_params.direct_capture = direct_capture;
|
nvfbc_params.direct_capture = direct_capture;
|
||||||
nvfbc_params.overclock = overclock;
|
nvfbc_params.overclock = overclock;
|
||||||
|
gsr_egl_unload(&egl);
|
||||||
capture = gsr_capture_nvfbc_create(&nvfbc_params);
|
capture = gsr_capture_nvfbc_create(&nvfbc_params);
|
||||||
if(!capture)
|
if(!capture)
|
||||||
_exit(1);
|
_exit(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user