mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
obs-ffmpeg: NVENC error logging improvements
This writes the result of nvEncGetLastErrorString to the last encoder error instead of just the log file. This makes it user-visible, which should help users diagnose and solve the problem. Also strips off leading colons from NVENC error strings as these can look odd given our format string. An example of such an error: ::NV_ENC_TWO_PASS_FULL_RESOLUTION is only supported multipass encoding on this architecture.
This commit is contained in:
committed by
Ryan Foster
parent
08af16edaf
commit
e593335086
@@ -37,11 +37,22 @@ bool nv_failed2(obs_encoder_t *encoder, void *session, NVENCSTATUS err,
|
||||
const char *func, const char *call)
|
||||
{
|
||||
struct dstr error_message = {0};
|
||||
const char *nvenc_error = NULL;
|
||||
|
||||
switch (err) {
|
||||
case NV_ENC_SUCCESS:
|
||||
if (err == NV_ENC_SUCCESS)
|
||||
return false;
|
||||
|
||||
if (session) {
|
||||
nvenc_error = nv.nvEncGetLastErrorString(session);
|
||||
if (nvenc_error) {
|
||||
// Some NVENC errors begin with :: which looks
|
||||
// odd to users. Strip it off.
|
||||
while (*nvenc_error == ':')
|
||||
nvenc_error++;
|
||||
}
|
||||
}
|
||||
|
||||
switch (err) {
|
||||
case NV_ENC_ERR_OUT_OF_MEMORY:
|
||||
obs_encoder_set_last_error(
|
||||
encoder, obs_module_text("NVENC.TooManySessions"));
|
||||
@@ -58,17 +69,23 @@ bool nv_failed2(obs_encoder_t *encoder, void *session, NVENCSTATUS err,
|
||||
break;
|
||||
|
||||
default:
|
||||
dstr_printf(&error_message,
|
||||
"NVENC Error: %s: %s failed: %d (%s)", func, call,
|
||||
(int)err, nv_error_name(err));
|
||||
if (nvenc_error && *nvenc_error) {
|
||||
dstr_printf(&error_message, "NVENC Error: %s (%s)",
|
||||
nvenc_error, nv_error_name(err));
|
||||
} else {
|
||||
|
||||
dstr_printf(&error_message,
|
||||
"NVENC Error: %s: %s failed: %d (%s)", func,
|
||||
call, (int)err, nv_error_name(err));
|
||||
}
|
||||
obs_encoder_set_last_error(encoder, error_message.array);
|
||||
dstr_free(&error_message);
|
||||
break;
|
||||
}
|
||||
|
||||
if (session) {
|
||||
if (nvenc_error && *nvenc_error) {
|
||||
error("%s: %s failed: %d (%s): %s", func, call, (int)err,
|
||||
nv_error_name(err), nv.nvEncGetLastErrorString(session));
|
||||
nv_error_name(err), nvenc_error);
|
||||
} else {
|
||||
error("%s: %s failed: %d (%s)", func, call, (int)err,
|
||||
nv_error_name(err));
|
||||
|
||||
Reference in New Issue
Block a user