On Fri, 15 Apr 2016 10:58:51 +0100 Mark Thompson <[email protected]> wrote:
> 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. > --- > libavutil/hwcontext_vaapi.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c > index 1a385ba..fd7f7b7 100644 > --- a/libavutil/hwcontext_vaapi.c > +++ b/libavutil/hwcontext_vaapi.c > @@ -779,6 +779,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); > + Would it be simpler for everyone not to fail and to use the minimum size in each dimension? Alternatively, we could document the constraints on which sizes can be passed to the API. > map = av_frame_alloc(); > if (!map) > return AVERROR(ENOMEM); > @@ -788,6 +791,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; > @@ -804,6 +810,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); > @@ -813,6 +822,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; _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
