diff mbox

[FFmpeg-devel,2/2] hwcontext_vaapi: Add an assert in vaapi_map_from_drm()

Message ID 20180510030823.15271-2-haihao.xiang@intel.com
State Accepted
Commit bed670a1de29b58fcb3fe046562d8bd125b1457f
Headers show

Commit Message

Xiang, Haihao May 10, 2018, 3:08 a.m. UTC
Every fourcc in vaapi_drm_format_map should be in
vaapi_format_map, so add an assert to ensure we have the right maps.

Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
---
 libavutil/hwcontext_vaapi.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Mark Thompson May 10, 2018, 7:04 p.m. UTC | #1
On 10/05/18 04:08, Haihao Xiang wrote:
> The flag of input_available must be set when pic_start is not NULL, so
> add an assert to ensure it is true. In addition, the assert on last_pic
> is unnecessary now, so remove this assert.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavcodec/vaapi_encode.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

On 10/05/18 04:08, Haihao Xiang wrote:
> Every fourcc in vaapi_drm_format_map should be in
> vaapi_format_map, so add an assert to ensure we have the right maps.
> 
> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
> ---
>  libavutil/hwcontext_vaapi.c | 2 ++
>  1 file changed, 2 insertions(+)

Both applied.

Thanks,

- Mark
Xiang, Haihao May 11, 2018, 12:39 a.m. UTC | #2
On Thu, 2018-05-10 at 20:04 +0100, Mark Thompson wrote:
> On 10/05/18 04:08, Haihao Xiang wrote:

> > The flag of input_available must be set when pic_start is not NULL, so

> > add an assert to ensure it is true. In addition, the assert on last_pic

> > is unnecessary now, so remove this assert.

> > 

> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>

> > ---

> >  libavcodec/vaapi_encode.c | 4 ++--

> >  1 file changed, 2 insertions(+), 2 deletions(-)

> 

> On 10/05/18 04:08, Haihao Xiang wrote:

> > Every fourcc in vaapi_drm_format_map should be in

> > vaapi_format_map, so add an assert to ensure we have the right maps.

> > 

> > Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>

> > ---

> >  libavutil/hwcontext_vaapi.c | 2 ++

> >  1 file changed, 2 insertions(+)

> 

> Both applied.


Thanks for applying the patches.

Best Regards
Haihao

> 

> Thanks,

> 

> - Mark

> _______________________________________________

> ffmpeg-devel mailing list

> ffmpeg-devel@ffmpeg.org

> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
diff mbox

Patch

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index 7daaa951cc..e55bb8db3f 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1028,6 +1028,8 @@  static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
             va_rt_format = vaapi_format_map[i].rt_format;
     }
 
+    av_assert0(i < FF_ARRAY_ELEMS(vaapi_format_map));
+
     buffer_handle = desc->objects[0].fd;
     buffer_desc.pixel_format = va_fourcc;
     buffer_desc.width        = src_fc->width;