Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata class_name field overwritten #23

Open
vesuvisian opened this issue Feb 1, 2024 · 1 comment
Open

Metadata class_name field overwritten #23

vesuvisian opened this issue Feb 1, 2024 · 1 comment

Comments

@vesuvisian
Copy link

Using the gst_objects_info_meta library and Python bindings, it seems that the class_name field is getting overwritten/corrupted. For instance, I've got detector and annotator elements, where the former is generating the bounding boxes, and the latter is drawing them on the frame. Printing things out while the pipeline runs, I get something like b'\x01' as the class label. I assume this has something to do with memory not being allocated correctly for that field but am not sure how to fix it.

@vesuvisian
Copy link
Author

Thanks to the help of someone more versed in C than myself, it looks like adding in something like

        for (int i=0; i<size; i++) {
            GstObjectInfo *object = objects->items+i;
            int class_name_len = 0;
            if (object->class_name != NULL) {
                class_name_len = strlen(object->class_name);
            }
            GstObjectInfo *object2 = gst_objects_info_meta->objects.items+i;
            if (class_name_len > 0) {
                object2->class_name = malloc(class_name_len+1);
                memcpy(object2->class_name, object->class_name, class_name+1);
            }
        }

immediately after the memcpy in the gst_buffer_add_objects_info_meta function seems to get it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant