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

[Common] util function to handle tensors #3546

Merged
merged 1 commit into from
Nov 10, 2021
Merged

[Common] util function to handle tensors #3546

merged 1 commit into from
Nov 10, 2021

Conversation

jaeyun-jung
Copy link
Collaborator

With gstreamer plugins, nnstreamer element may receive gst-buffer with invalid memory chunks.
nnstreamer internally checks the number of tensors using the mem blocks in gst-buffer.

To handle multi tensors, add util function to separate memories in gst-buffer.

Signed-off-by: Jaeyun jy1210.jung@samsung.com

@taos-ci
Copy link
Collaborator

taos-ci commented Nov 3, 2021

📝 TAOS-CI Version: 1.5.20200925. Thank you for submitting PR #3546. Please a submit 1commit/1PR (one commit per one PR) policy to get comments quickly from reviewers. Your PR must pass all verificiation processes of cibot before starting a review process from reviewers. If you are new member to join this project, please read manuals in documentation folder and wiki page. In order to monitor a progress status of your PR in more detail, visit http://nnstreamer.mooo.com/.

Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaeyun-jung, 💯 All CI checkers are successfully verified. Thanks.

gboolean configured = FALSE;

if (!GST_IS_BUFFER (in) || !gst_tensors_config_validate (config))
goto error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about just returning NULL? gst_buffer_unref can be called when in is a non-buffer instance.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, updated.

Copy link
Member

@myungjoo myungjoo Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have started writing more elaborated error messages for exceptions.
Please describe the error and how the user should correct the error.

Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaeyun-jung, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaeyun-jung, 💯 All CI checkers are successfully verified. Thanks.

Copy link
Member

@anyj0527 anyj0527 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Member

@dongju-chae dongju-chae left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}

if (!gst_buffer_map (in, &map, GST_MAP_READ))
goto error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this error.

for (i = 0; i < num; i++) {
/* invalid memory size */
if (offset + mem_size[i] > total)
goto error;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, too.

Copy link
Member

@myungjoo myungjoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "useful" error messages (what's wrong & how to fix it) for all error/exceptions.

With gstreamer plugins, nnstreamer element may receive gst-buffer with invalid memory chunks.
nnstreamer internally checks the number of tensors using the mem blocks in gst-buffer.

To handle multi tensors, add util function to separate memories in gst-buffer.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
Copy link
Collaborator

@taos-ci taos-ci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaeyun-jung, 💯 All CI checkers are successfully verified. Thanks.

@myungjoo myungjoo merged commit 837beb7 into nnstreamer:main Nov 10, 2021
@jaeyun-jung jaeyun-jung deleted the common-get-tensorbuffer branch November 12, 2021 05:35
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

Successfully merging this pull request may close these issues.

None yet

6 participants