summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-04-15 10:44:02 +0200
committerAnton Khirnov <anton@khirnov.net>2016-06-28 08:31:28 +0200
commitfdfe01365d579189d9a55b3741dba2ac46eb1df8 (patch)
tree4d93a5b8cb3cb3f5a7e927fdd8fa6fcc6a1576fe
parent5fcae3b3f93fd02b3d1e009b9d9b17410fca9498 (diff)
hwcontext: allocate the destination frame for the pool size
The source frame may be cropped, so that its dimensions are smaller than the pool dimensions. The transfer_data API requires the allocated size of the destination frame to be the same as the pool size.
-rw-r--r--libavutil/hwcontext.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index 96b316afa8..b47ef44fa7 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -321,6 +321,7 @@ int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref,
static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags)
{
+ AVHWFramesContext *ctx = (AVHWFramesContext*)src->hw_frames_ctx->data;
AVFrame *frame_tmp;
int ret = 0;
@@ -343,8 +344,8 @@ static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags)
frame_tmp->format = formats[0];
av_freep(&formats);
}
- frame_tmp->width = src->width;
- frame_tmp->height = src->height;
+ frame_tmp->width = ctx->width;
+ frame_tmp->height = ctx->height;
ret = av_frame_get_buffer(frame_tmp, 32);
if (ret < 0)
@@ -354,6 +355,9 @@ static int transfer_data_alloc(AVFrame *dst, const AVFrame *src, int flags)
if (ret < 0)
goto fail;
+ frame_tmp->width = src->width;
+ frame_tmp->height = src->height;
+
av_frame_move_ref(dst, frame_tmp);
fail: