GNOME Bugzilla – Bug 706478
GstAppSrc: new gst_app_src_push_sample() API for appsrc
Last modified: 2013-08-21 11:23:16 UTC
Would be better if both GstAppSrc and GstAppSink operate on GstSample. Use case: If a pipeline bridge is created between appsink of a pipeline to appsrc of another pipeline then, always buffer copy has to be made before pushing the buffer to GstAppSrc, because there is no API on appsrc which can accept GstSample of GstSample of the GstAppSink (gst_app_sink_pull_sample API). There is an overhead of gst_buffer_copy of every buffer in the following code (Present API) GstSample *sample = gst_app_sink_pull_sample(appsink); gst_app_src_push_buffer(appsrc, gst_buffer_copy(gst_sample_get_buffer(sample))); gst_sample_unref(sample); // push_buffer api takes owner ship of the GstBuffer, so we can't just pass the buffer of the sample instead we have to copy the buffer and push to appsrc With the proposed API for GstAppSrc (gst_app_src_push_sample()) GstSample *sample = gst_app_sink_pull_sample(appsink); gst_app_src_push_sample(appsrc, sample); // which will take owner ship of the sample
No need to copy, just ref the buffer, then free the sample, then push the buffer in appsrc.
(In reply to comment #1) > No need to copy, just ref the buffer, then free the sample, then push the > buffer in appsrc. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstSample.html#gst-sample-get-buffer Here documentation says, The buffer remains valid as long as sample is valid. So , I thought 'ref the buffer' might not help here. If ref does the job then this bug can be closed. Thanks.
commit aa1890a4b461f4b1b353f2583977cff74f98159f Author: Tim-Philipp Müller <tim@centricular.net> Date: Wed Aug 21 12:21:43 2013 +0100 docs: flesh out gst_sample_get_buffer() a little https://bugzilla.gnome.org/show_bug.cgi?id=706478