Thx for your quick response
I adopted my code to your suggestions! However now I’m getting the following error, when calling NvBufferTransformEx
Invalid snSurfaces[0]
Have you got any pointers what I might be doing wrong?
Here’s the code of my Consumer-process
while (true) {
sync_parameters source_params{};
auto read_count = socket.receive(
boost::asio::buffer(&source_params, sizeof(source_params)));
assert(read_count == sizeof(source_params));
int target_dmabuf_fd{};
{
NvBufferCreateParams create_params{};
create_params.width = source_params.params.width[0];
create_params.height = source_params.params.height[0];
create_params.colorFormat = source_params.params.pixel_format;
int result = NvBufferCreateEx(&target_dmabuf_fd, &create_params);
assert (result != -1);
}
NvBufferParams target_params{};
{
int result = NvBufferGetParams(target_dmabuf_fd, &target_params);
assert (result != -1);
}
NvBufferParamsEx target_params_ex{};
{
int result = NvBufferGetParamsEx(target_dmabuf_fd, &target_params_ex);
assert (result != -1);
}
{
NvBufferTransformParams transform_params{};
memset(&transform_params, 0, sizeof(NvBufferTransformParams));
transform_params.src_rect = {0, 0, source_params.params.width[0],
source_params.params.height[0]};
transform_params.dst_rect = {0, 0, target_params.width[0],
target_params.height[0]};
int source_dmabuf_fd = source_params.params.dmabuf_fd;
int result = NvBufferTransformEx(
source_dmabuf_fd, &source_params.params_ex, target_dmabuf_fd,
&target_params_ex, &transform_params);
if (result == -1)
return 1;
}
The producer Proccess gets the information from gstreamer like this:
GstFlowReturn appsink_new_sample(GstAppSink *appsink, gpointer data) {
ipc *ipc_ = static_cast<ipc *>(data);
GstSample *sample = gst_app_sink_pull_sample(appsink);
assert (sample);
GstCaps *caps = gst_sample_get_caps(sample);
assert(caps);
gst_caps_get_structure(caps, 0);
GstBuffer *buffer = gst_sample_get_buffer(sample);
GstMapInfo map = {0};
gst_buffer_map(buffer, &map, GST_MAP_READ);
int dmabuf_fd{};
{
const int success =
ExtractFdFromNvBuffer(static_cast<void *>(map.data), &dmabuf_fd);
assert (success == 0);
}
auto send = std::make_shared<sync_parameters>();
{
int result = NvBufferGetParamsEx(dmabuf_fd, &send->params_ex);
assert (result != -1);
}
{
int result = NvBufferGetParams(dmabuf_fd, &send->params);
assert (result != -1);
}
ipc_->send(send);
Any help would be greatly appreciated. thx for your time!