analytics: always add GstTensorMeta

Always add GstTensorMeta to buffer instead of re-using existing GstTensorMeta
when it's already present. The reason for the change is when we have cascaded
inference elements overwriting (tflite) or leaking (ONNX) GstTensorMeta when we
have cascaded inferences. We didn't create and API to append to GstTensorMeta
and I think it's more convenient to have a new GstTensorMeta for each
inferences. It's also more clear that a group of tensor was produced by one
inference but doesn't limit tensordecoders from using tensors produced by
multiple inference. I don't see much value in having all tensors data always
inside one GstTensorMeta since appending would mean re-allocation of the tensors
array anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/9564>
This commit is contained in:
Daniel Morin 2025-08-17 15:58:22 -04:00 committed by GStreamer Marge Bot
parent 0f4bddc9a9
commit 3eefb6c5db

View File

@ -117,7 +117,7 @@ gst_tensor_meta_get_info (void)
* gst_buffer_add_tensor_meta:
* @buffer: A writable #GstBuffer
*
* Adds a #GstTensorMeta to a buffer or returns the existing one
* Adds a #GstTensorMeta to a buffer
*
* Returns: (transfer none): The new #GstTensorMeta
*
@ -127,12 +127,6 @@ gst_tensor_meta_get_info (void)
GstTensorMeta *
gst_buffer_add_tensor_meta (GstBuffer * buffer)
{
GstTensorMeta *tmeta;
tmeta = gst_buffer_get_tensor_meta (buffer);
if (tmeta)
return tmeta;
return (GstTensorMeta *) gst_buffer_add_meta (buffer,
gst_tensor_meta_get_info (), NULL);
}