[FFmpeg-devel] [PATCH 1/2] hwcontext_vaapi: add support when driver return unimplemented.
Jun Zhao
mypopydev at gmail.com
Mon Nov 20 02:36:37 EET 2017
-------------- next part --------------
From 5cbcd032de46e6a3f9563d1781776ea26728079d Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao at intel.com>
Date: Sat, 18 Nov 2017 10:44:44 +0800
Subject: [PATCH 1/2] hwcontext_vaapi: add support when driver return
unimplemented.
iHD driver sometime return unimplemented when query surface attributes,
we just ignore and give a warning in this case.
Signed-off-by: Jun Zhao <jun.zhao at intel.com>
---
libavutil/hwcontext_vaapi.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 0382eb06f2..f246639021 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -169,7 +169,10 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev,
attr_count = 0;
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
0, &attr_count);
- if (vas != VA_STATUS_SUCCESS) {
+ // Sometime driver return unimplemeted - ignore and warning.
+ if (vas == VA_STATUS_ERROR_UNIMPLEMENTED) {
+ av_log(hwdev, AV_LOG_WARNING, "Query surface attributes not implemented.\n");
+ } else if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
@@ -177,14 +180,17 @@ static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev,
}
attr_list = av_malloc(attr_count * sizeof(*attr_list));
- if (!attr_list) {
+ if (attr_count != 0 && !attr_list) {
err = AVERROR(ENOMEM);
goto fail;
}
vas = vaQuerySurfaceAttributes(hwctx->display, config->config_id,
attr_list, &attr_count);
- if (vas != VA_STATUS_SUCCESS) {
+ // Sometime driver return unimplemeted - ignore and warning.
+ if (vas == VA_STATUS_ERROR_UNIMPLEMENTED) {
+ av_log(hwdev, AV_LOG_WARNING, "Query surface attributes not implemented.\n");
+ } else if (vas != VA_STATUS_SUCCESS) {
av_log(hwdev, AV_LOG_ERROR, "Failed to query surface attributes: "
"%d (%s).\n", vas, vaErrorStr(vas));
err = AVERROR(ENOSYS);
--
2.14.1
More information about the ffmpeg-devel
mailing list