[FFmpeg-devel] [PATCH 2/2] hwcontext_vaapi: Zero unused fields of external buffer descriptor

Mark Thompson sw at jkqxz.net
Mon Sep 3 03:01:54 EEST 2018


---
Though nothing should look directly as these fields having random stack data in them is confusing for debugging.


 libavutil/hwcontext_vaapi.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index cc3739f6ec..9dc1d30d37 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -1039,13 +1039,15 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
     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;
-    buffer_desc.height       = src_fc->height;
-    buffer_desc.data_size    = desc->objects[0].size;
-    buffer_desc.buffers      = &buffer_handle;
-    buffer_desc.num_buffers  = 1;
-    buffer_desc.flags        = 0;
+    buffer_desc = (VASurfaceAttribExternalBuffers) {
+        .pixel_format = va_fourcc,
+        .width        = src_fc->width,
+        .height       = src_fc->height,
+        .data_size    = desc->objects[0].size,
+        .buffers      = &buffer_handle,
+        .num_buffers  = 1,
+        .flags        = 0,
+    };
 
     k = 0;
     for (i = 0; i < desc->nb_layers; i++) {
-- 
2.18.0


More information about the ffmpeg-devel mailing list