mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-10-24 01:59:17 +08:00
obs-ffmpeg: Show detailed NVENC error messages
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user