Custom pipeline Error(batch size Not 1)

Hi @bcao

this is last topic

i made a pipeline follow your suggest

what I want to make is change over from streammux’s src data(N Batched data) to single batched data(composited) after processing my customplugin’s transform function

like i wrote before i think overlaysink has to contain only one batched data

i found function called “transform” in GstBaseTransform API Reference doc, i think if use it i can make i want

i tried.(referred to topic of similar problem)
my transform code is below, but something seems to be wrong.

static GstFlowReturn
gst_menudraw_transform (GstBaseTransform * btrans, GstBuffer * inbuf, GstBuffer * outbuf)
{
GstMenuDraw *menudraw = GST_MENUDRAW (btrans);
GstFlowReturn flow_ret = GST_FLOW_ERROR;
GstMapInfo in_map_info;
GstMapInfo out_map_info;
NvBufSurface *insurface = NULL;
NvBufSurface *outsurface = NULL;
NvDsBatchMeta *batch_meta = NULL;
NvDsMeta *meta = NULL;
NvDsFrameMeta *frame_meta = NULL;
g_print (“TransForm \n”);

if (!gst_buffer_map (inbuf, &in_map_info, GST_MAP_READWRITE)) {
g_print (“Error: Failed to in map gst buffer\n”);
goto error;
}
if (!gst_buffer_map (outbuf, &out_map_info, GST_MAP_READWRITE)) {
g_print (“Error: Failed to out map gst buffer\n”);
goto error;
}
outsurface = (NvBufSurface *)out_map_info.data;

batch_meta = nvds_create_batch_meta(1);
meta = gst_buffer_add_nvds_meta (outbuf , batch_meta, NULL, copy_user_meta, release_user_meta);
meta->meta_type = NVDS_BATCH_GST_META;
batch_meta->base_meta.batch_meta = batch_meta;
batch_meta->base_meta.copy_func = copy_user_meta;
batch_meta->base_meta.release_func = release_user_meta;
batch_meta->max_frames_in_batch = 1;
frame_meta = nvds_acquire_frame_meta_from_pool(batch_meta);
nvds_add_frame_meta_to_batch(batch_meta, frame_meta);
frame_meta->pad_index = 0;
frame_meta->source_id = 0;
frame_meta->frame_num = 0;
frame_meta->batch_id = 0;
frame_meta->source_frame_width = 1024;
frame_meta->source_frame_height = 600;
frame_meta->num_surfaces_per_frame = 1 ;

g_print(“out buf Patch size %u\n”,batch_meta->num_frames_in_batch);
Process_Draw_Menu(insurface, outsurface, outbuf);
flow_ret = GST_FLOW_OK;
g_print (“TransForm OK\n”);

error:
gst_buffer_unmap (inbuf, &in_map_info);
gst_buffer_unmap (outbuf, &out_map_info);
return flow_ret;
}

function of the Process_Draw_Menu

  1. Draw menu UI
  2. Draw overlay N camera sources a fixed area on 1.
  3. Finally i want to output buf has to 1 batch data

so i want to make to my plugin similar like nvmultistreamtiler(N batch data input → process → one batch data output)

I don’t know if the way I try is right.

Thanks.