diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.cpp b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.cpp index e7844a8d6e..f070d5b617 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.cpp +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.cpp @@ -1671,3 +1671,34 @@ gst_cuda_create_user_token (void) return user_token.fetch_add (1); } + +/** + * _gst_cuda_debug: + * @result: CUDA result code + * @cat: a #GstDebugCategory + * @file: the file that checking the result code + * @function: the function that checking the result code + * @line: the line that checking the result code + * + * Returns: %TRUE if CUDA device API call result is CUDA_SUCCESS + * + * Since: 1.24 + */ +gboolean +_gst_cuda_debug (CUresult result, GstDebugCategory * cat, + const gchar * file, const gchar * function, gint line) +{ + if (result != CUDA_SUCCESS) { +#ifndef GST_DISABLE_GST_DEBUG + const gchar *_error_name, *_error_text; + CuGetErrorName (result, &_error_name); + CuGetErrorString (result, &_error_text); + gst_debug_log (cat, GST_LEVEL_WARNING, file, function, line, + NULL, "CUDA call failed: %s, %s", _error_name, _error_text); +#endif + + return FALSE; + } + + return TRUE; +} diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h index b93fe494b7..5e91e20139 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h @@ -27,41 +27,14 @@ G_BEGIN_DECLS +GST_CUDA_API +gboolean _gst_cuda_debug (CUresult result, + GstDebugCategory * cat, + const gchar * file, + const gchar * function, + gint line); + #ifndef GST_DISABLE_GST_DEBUG -static inline gboolean -_gst_cuda_debug(CUresult result, GstDebugCategory * category, - const gchar * file, const gchar * function, gint line) -{ - const gchar *_error_name, *_error_text; - if (result != CUDA_SUCCESS) { - CuGetErrorName (result, &_error_name); - CuGetErrorString (result, &_error_text); - gst_debug_log (category, GST_LEVEL_WARNING, file, function, line, - NULL, "CUDA call failed: %s, %s", _error_name, _error_text); - - return FALSE; - } - - return TRUE; -} - -/** - * gst_cuda_result: - * @result: CUDA device API return code `CUresult` - * - * Returns: %TRUE if CUDA device API call result is CUDA_SUCCESS - */ -#define gst_cuda_result(result) \ - _gst_cuda_debug(result, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__) -#else - -static inline gboolean -_gst_cuda_debug(CUresult result, GstDebugCategory * category, - const gchar * file, const gchar * function, gint line) -{ - return result == CUDA_SUCCESS; -} - /** * gst_cuda_result: * @result: CUDA device API return code `CUresult` @@ -70,9 +43,12 @@ _gst_cuda_debug(CUresult result, GstDebugCategory * category, * * Since: 1.22 */ +#define gst_cuda_result(result) \ + _gst_cuda_debug(result, GST_CAT_DEFAULT, __FILE__, GST_FUNCTION, __LINE__) +#else #define gst_cuda_result(result) \ _gst_cuda_debug(result, NULL, __FILE__, GST_FUNCTION, __LINE__) -#endif +#endif /* GST_DISABLE_GST_DEBUG */ /** * GstCudaQuarkId: