context: Make it clear why we copy the ids

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
This commit is contained in:
Maxime Ripard
2018-06-13 17:06:33 +02:00
committed by Paul Kocialkowski
parent 9f2c069f76
commit 53a8c6e1cf
+7 -2
View File
@@ -96,12 +96,19 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
goto error;
}
/*
* The surface_ids array has been allocated by the caller and
* we don't have any indication wrt its life time. Let's make sure
* its life span is under our control.
*/
ids = malloc(surfaces_count * sizeof(VASurfaceID));
if (ids == NULL) {
status = VA_STATUS_ERROR_ALLOCATION_FAILED;
goto error;
}
memcpy(ids, surfaces_ids, surfaces_count * sizeof(VASurfaceID));
for (i = 0; i < surfaces_count; i++) {
surface_object = SURFACE(surfaces_ids[i]);
if (surface_object == NULL) {
@@ -125,8 +132,6 @@ VAStatus SunxiCedrusCreateContext(VADriverContextP context,
surface_object->destination_index = i;
surface_object->source_data = source_data;
surface_object->source_size = length;
ids[i] = surfaces_ids[i];
}
rc = v4l2_set_stream(driver_data->video_fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, true);