From e87ecf448b7130f28b6b40ba95d708d695e06bd0 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Sat, 13 Apr 2024 10:57:43 +0100 Subject: [PATCH] vpxdec: Include vpx error details in errors and warnings Part-of: --- .../gst-plugins-good/ext/vpx/gstvpxcompat.h | 9 +++++++++ .../gst-plugins-good/ext/vpx/gstvpxdec.c | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/subprojects/gst-plugins-good/ext/vpx/gstvpxcompat.h b/subprojects/gst-plugins-good/ext/vpx/gstvpxcompat.h index 71ca6b2427..c132d8c36b 100644 --- a/subprojects/gst-plugins-good/ext/vpx/gstvpxcompat.h +++ b/subprojects/gst-plugins-good/ext/vpx/gstvpxcompat.h @@ -51,4 +51,13 @@ typedef enum gst_vpx_img_fmt GST_STR_NULL(element->encoder.err_detail)); \ } \ G_STMT_END + +#define GST_VPX_DEC_WARN(element, message, status) \ + G_STMT_START { \ + GST_WARNING_OBJECT(element, "%s: %s (details: %s)", #message, \ + gst_vpx_error_name(status), \ + GST_STR_NULL(element->decoder.err_detail)); \ + } \ + G_STMT_END + G_END_DECLS diff --git a/subprojects/gst-plugins-good/ext/vpx/gstvpxdec.c b/subprojects/gst-plugins-good/ext/vpx/gstvpxdec.c index 091207d957..5e12dfef99 100644 --- a/subprojects/gst-plugins-good/ext/vpx/gstvpxdec.c +++ b/subprojects/gst-plugins-good/ext/vpx/gstvpxdec.c @@ -600,8 +600,7 @@ gst_vpx_dec_open_codec (GstVPXDec * dec, GstVideoCodecFrame * frame) gst_buffer_unmap (frame->input_buffer, &minfo); if (status != VPX_CODEC_OK) { - GST_INFO_OBJECT (dec, "VPX preprocessing error: %s", - gst_vpx_error_name (status)); + GST_VPX_DEC_WARN (dec, "VPX preprocessing error", status); return GST_FLOW_CUSTOM_SUCCESS_1; } @@ -639,9 +638,12 @@ gst_vpx_dec_open_codec (GstVPXDec * dec, GstVideoCodecFrame * frame) status = vpx_codec_dec_init (&dec->decoder, vpxclass->codec_algo, &cfg, flags); if (status != VPX_CODEC_OK) { - GST_ELEMENT_ERROR (dec, LIBRARY, INIT, - ("Failed to initialize VP8 decoder"), ("%s", - gst_vpx_error_name (status))); + GST_ELEMENT_ERROR_WITH_DETAILS (dec, LIBRARY, INIT, + ("Failed to initialize VP8 decoder"), ("%s (details: %s)", + gst_vpx_error_name (status), + GST_STR_NULL (dec->decoder.err_detail)), ("error", G_TYPE_STRING, + gst_vpx_error_name (status), "details", G_TYPE_STRING, + GST_STR_NULL (dec->decoder.err_detail), NULL)); return GST_FLOW_ERROR; } @@ -654,8 +656,7 @@ gst_vpx_dec_open_codec (GstVPXDec * dec, GstVideoCodecFrame * frame) status = vpx_codec_control (&dec->decoder, VP8_SET_POSTPROC, &pp_cfg); if (status != VPX_CODEC_OK) { - GST_WARNING_OBJECT (dec, "Couldn't set postprocessing settings: %s", - gst_vpx_error_name (status)); + GST_VPX_DEC_WARN (dec, "Couldn't set postprocessing settings", status); } } vpx_codec_set_frame_buffer_functions (&dec->decoder, @@ -726,7 +727,9 @@ gst_vpx_dec_handle_frame (GstVideoDecoder * decoder, GstVideoCodecFrame * frame) GstVideoDecoderRequestSyncPointFlags flags = 0; GST_VIDEO_DECODER_ERROR (decoder, 1, STREAM, DECODE, - ("Failed to decode frame"), ("%s", gst_vpx_error_name (status)), ret); + ("Failed to decode frame"), ("%s (details: %s)", + gst_vpx_error_name (status), + GST_STR_NULL (dec->decoder.err_detail)), ret); if (gst_video_decoder_get_needs_sync_point (decoder)) flags |= GST_VIDEO_DECODER_REQUEST_SYNC_POINT_DISCARD_INPUT;