summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-04-15 10:58:51 +0100
committerAnton Khirnov <anton@khirnov.net>2016-06-28 08:32:11 +0200
commitf62bb216ac4cfbbff16108c6bac35a0282532972 (patch)
treeafcd02a675fb44158fb2ac2dc8a0cf97d51f0fb7
parentc3f113d58488df7594a489bdbb993a69ad47063c (diff)
hwcontext_vaapi: allow transfers to/from any size of sw frame
The hw frame used as reference has an attached size but it need not match the actual size of the surface, so enforcing that the sw frame used in copying matches its size exactly is not useful. Signed-off-by: Anton Khirnov <anton@khirnov.net>
-rw-r--r--libavutil/hwcontext_vaapi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 1bdc4cbc1a..ee5ce5d075 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -770,6 +770,9 @@ static int vaapi_transfer_data_from(AVHWFramesContext *hwfc,
AVFrame *map;
int err;
+ if (dst->width > hwfc->width || dst->height > hwfc->height)
+ return AVERROR(EINVAL);
+
map = av_frame_alloc();
if (!map)
return AVERROR(ENOMEM);
@@ -779,6 +782,9 @@ static int vaapi_transfer_data_from(AVHWFramesContext *hwfc,
if (err)
goto fail;
+ map->width = dst->width;
+ map->height = dst->height;
+
err = av_frame_copy(dst, map);
if (err)
goto fail;
@@ -795,6 +801,9 @@ static int vaapi_transfer_data_to(AVHWFramesContext *hwfc,
AVFrame *map;
int err;
+ if (src->width > hwfc->width || src->height > hwfc->height)
+ return AVERROR(EINVAL);
+
map = av_frame_alloc();
if (!map)
return AVERROR(ENOMEM);
@@ -804,6 +813,9 @@ static int vaapi_transfer_data_to(AVHWFramesContext *hwfc,
if (err)
goto fail;
+ map->width = src->width;
+ map->height = src->height;
+
err = av_frame_copy(map, src);
if (err)
goto fail;