[FFmpeg-devel] [PATCH] lavu/hwcontext_vaapi: provide detailed error msg if directly mapping fails

Linjie Fu linjie.fu at intel.com
Thu Aug 15 07:32:42 EEST 2019


Detailed message could be helpful when using hwmap=mode=direct,format=xxx
for both qsv and vaapi.

Signed-off-by: Linjie Fu <linjie.fu at intel.com>
---
 libavutil/hwcontext_vaapi.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cf117640f2..3fbeb4954e 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -747,19 +747,22 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc,
     av_log(hwfc, AV_LOG_DEBUG, "Map surface %#x.\n", surface_id);
 
     if (!ctx->derive_works && (flags & AV_HWFRAME_MAP_DIRECT)) {
-        // Requested direct mapping but it is not possible.
+        av_log(hwfc, AV_LOG_ERROR, "Requested direct mapping but "
+                                            "it is not possible.\n");
         return AVERROR(EINVAL);
     }
     if (dst->format == AV_PIX_FMT_NONE)
         dst->format = hwfc->sw_format;
     if (dst->format != hwfc->sw_format && (flags & AV_HWFRAME_MAP_DIRECT)) {
-        // Requested direct mapping but the formats do not match.
+        av_log(hwfc, AV_LOG_ERROR, "Requested direct mapping but "
+                                        "the formats do not match.\n");
         return AVERROR(EINVAL);
     }
 
     err = vaapi_get_image_format(hwfc->device_ctx, dst->format, &image_format);
     if (err < 0) {
-        // Requested format is not a valid output format.
+        av_log(hwfc, AV_LOG_ERROR, "Requested format is "
+                                        "not a valid output format.\n");
         return AVERROR(EINVAL);
     }
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list