obs-ffmpeg: Show detailed NVENC error messages

This commit is contained in:
jp9000
2022-09-22 02:42:32 -07:00
parent 6c474fecab
commit 3b7f15a046
2 changed files with 20 additions and 9 deletions
+11 -6
View File
@@ -10,7 +10,7 @@ NV_CREATE_INSTANCE_FUNC nv_create_instance = NULL;
#define error(format, ...) blog(LOG_ERROR, "[jim-nvenc] " format, ##__VA_ARGS__)
bool nv_fail(obs_encoder_t *encoder, const char *format, ...)
bool nv_fail2(obs_encoder_t *encoder, void *session, const char *format, ...)
{
struct dstr message = {0};
struct dstr error_message = {0};
@@ -30,8 +30,8 @@ bool nv_fail(obs_encoder_t *encoder, const char *format, ...)
return true;
}
bool nv_failed(obs_encoder_t *encoder, NVENCSTATUS err, const char *func,
const char *call)
bool nv_failed2(obs_encoder_t *encoder, void *session, NVENCSTATUS err,
const char *func, const char *call)
{
struct dstr error_message = {0};
@@ -63,12 +63,17 @@ bool nv_failed(obs_encoder_t *encoder, NVENCSTATUS err, const char *func,
break;
}
error("%s: %s failed: %d (%s)", func, call, (int)err,
nv_error_name(err));
if (session) {
error("%s: %s failed: %d (%s): %s", func, call, (int)err,
nv_error_name(err), nv.nvEncGetLastErrorString(session));
} else {
error("%s: %s failed: %d (%s)", func, call, (int)err,
nv_error_name(err));
}
return true;
}
#define NV_FAILED(e, x) nv_failed(e, x, __FUNCTION__, #x)
#define NV_FAILED(e, x) nv_failed2(e, NULL, x, __FUNCTION__, #x)
bool load_nvenc_lib(void)
{
+9 -3
View File
@@ -13,6 +13,12 @@ extern const char *nv_error_name(NVENCSTATUS err);
extern NV_ENCODE_API_FUNCTION_LIST nv;
extern NV_CREATE_INSTANCE_FUNC nv_create_instance;
extern bool init_nvenc(obs_encoder_t *encoder);
bool nv_fail(obs_encoder_t *encoder, const char *format, ...);
bool nv_failed(obs_encoder_t *encoder, NVENCSTATUS err, const char *func,
const char *call);
bool nv_fail2(obs_encoder_t *encoder, void *session, const char *format, ...);
bool nv_failed2(obs_encoder_t *encoder, void *session, NVENCSTATUS err,
const char *func, const char *call);
#define nv_fail(encoder, format, ...) \
nv_fail2(encoder, enc->session, format, ##__VA_ARGS__)
#define nv_failed(encoder, err, func, call) \
nv_failed2(encoder, enc->session, err, func, call)