appsrc performance issue

Nicolas Dufresne nicolas at ndufresne.ca
Tue Jan 7 19:00:46 UTC 2020


Le mardi 07 janvier 2020 à 00:16 -0600, mksafavi a écrit :
> Hi.
> 
> when I push my buffer to appsrc it takes too much time. (about 20ms for each
> buffer).
> I want this process to be zero-copy.
> 
> my data after processing is stored in a physically contiguous array pointer
> (data->dest_vptr).
> then I wrapped this array on a gst_memory and append it to the out_buffer
> which I push to appsrc.
> 
> out_buffer = gst_buffer_new();
> gst_buffer_append_memory (out_buffer,gst_memory_new_wrapped
> (GST_MEMORY_FLAG_READONLY,data->dest_vptr, DEST_BUF_SIZE, 0, DEST_BUF_SIZE,
> NULL, NULL));
> source = gst_bin_get_by_name(GST_BIN(data->sink), "testsource");
> ret = gst_app_src_push_buffer(GST_APP_SRC(source), out_buffer);
> return ret;
> 
> in my pipeline, I have an accelerator that takes 19ms to finish its job.
> filesrc -> decoder -> encoder -> filesink : 10ms per frame
> filesrc -> decoder -> appsink -> [accelerator] -> appsrc -> encoder ->
> filesink : 50ms per frame ( expecting approximately 30ms)
> 
> apprsc parameters:
> testsource = gst_bin_get_by_name(GST_BIN(data->sink), "testsource");
>     g_object_set(testsource, "format", GST_FORMAT_TIME, "block", FALSE,
> NULL);
>     gst_object_unref(testsource);
> 
> Am I doing an unnecessary copy somewhere? or having bad appsrc parameter
> settings?
> I also checked with fake sink directly after appsrc and made sure the appsrc
> is bottlenecking.

Did you located a copy? do you notice higher CPU if you do appsink ->
appsrc (skipping the accel) ? (GST_DEBUG="*PERF*:5") A copy can happen
in such case if the decoder requires GstVideoMeta. Here's an example
code using appsink that enables GstVideoMeta (to allow zero-copy):

https://gitlab.freedesktop.org/mesa/kmscube/blob/master/gst-decoder.c#L242

This is all dependent on the decoder being used, which you have
abstracted here.

> 
> thanks
> 
> 
> 
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list