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

Fix buffer size for non-NVMM buffer when chunk enabled #101

Merged
merged 1 commit into from
May 22, 2024

Conversation

AdminXVII
Copy link
Contributor

When chunk data is active, GetBufferSize() returns the size of the image itself plus the chunk data. However, the GstBuffer should only contain the image data since the metadata is already parsed and put into the buffer's "Meta"s.

Tested using the pipeline pylonsrc user-set=UserSet1 | bayer2rgb | filesink location=<...> where UserSet1 has chunk data enabled. Previous behaviour was for bayer2rgb to fail because the buffer size did not match the expected size (width * height), now it works as expected.

When chunk data is active, GetBufferSize() returns the size of the image itself plus the chunk data.
However, the GstBuffer should only contain the image data since the metadata is already parsed and put into the buffer's "Meta"s.

Tested using the pipeline `pylonsrc user-set=UserSet1 | bayer2rgb | filesink location=<...>` where UserSet1 has chunk data enabled. Previous behaviour was for bayer2rgb to fail because the buffer size did not match the expected size (width * height), now it works as expected.
@thiesmoeller
Copy link
Collaborator

Thanks for providing the PR.

In chunked mode the image will always start at byte 0 of the buffer.

Checking the NVMM path, we don't have the problem here, as we simply transfer base buffer pointer and the shape/type.
So memory size will fit.

@AdminXVII
Copy link
Contributor Author

AdminXVII commented May 17, 2024

Yes, this only changes the non-NVMM path.
The offset is 0 and is correct, however the problem is with the buffer passed to GStreamer. The pipeline expects only the image data in the buffer (GetImageSize()), but currently the plugin passes the framegrabber buffer size (GetBufferSize()), which is GetImageSize() + the size of the chunks (the latter being already passed as metas).

@thiesmoeller thiesmoeller merged commit 3b8cfc7 into basler:main May 22, 2024
4 of 5 checks passed
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.

2 participants