On 12/30/2016 04:06 PM, Xiang, Haihao wrote:
Sometimes user doesn't assign a proper value to each field in a buffer
when calling vaRenderPicture(), which will result in random issues
if we want to use these fields in the future. E.g. recently we used
window_size in VAEncMiscParameterRateControl for bitrate control.

This looks good to me.

Add: Reviewed-by: Zhao Yakui <yakui.z...@intel.com>


Signed-off-by: Xiang, Haihao<haihao.xi...@intel.com>
---
  src/i965_drv_video.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 15920f5..51a708c 100644
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2519,8 +2519,12 @@ i965_create_buffer_internal(VADriverContextP ctx,
              buffer_store->buffer = malloc(msize * num_elements);
          assert(buffer_store->buffer);

-        if (data&&  (!wrapper_flag))
-            memcpy(buffer_store->buffer, data, size * num_elements);
+        if (!wrapper_flag) {
+            if (data)
+                memcpy(buffer_store->buffer, data, size * num_elements);
+            else
+                memset(buffer_store->buffer, 0, size * num_elements);
+        }
      }

      buffer_store->num_elements = obj_buffer->num_elements;

_______________________________________________
Libva mailing list
Libva@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to