<br><br><div class="gmail_quote">On Sat, Feb 27, 2010 at 10:16 PM, na <span dir="ltr">&lt;<a href="mailto:nahmed31@hotmail.com">nahmed31@hotmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hello,<br>
<br>
I am trying to write a sample example where I can push and pull audio<br>
buffers via appsrc and appsink to a simple pipeline that will resample the<br>
audio.<br>
<br>
I created a simple example that sets up the pipeline and tries to push and<br>
pull a single buffer. When I run the code below, I get the following output:<br>
<br>
 ./rxpipeline --gst-debug-level=2<br>
0:00:00.148913625 22049  0x94e42c0 WARN           basetransform<br>
gstbasetransform.c:1969:gst_base_transform_handle_buffer:&lt;audiores&gt; error:<br>
not negotiated<br>
0:00:00.149326247 22049  0x94e42c0 WARN           basetransform<br>
gstbasetransform.c:1969:gst_base_transform_handle_buffer:&lt;audiores&gt; error:<br>
not negotiated<br>
0:00:00.149653838 22049  0x94e42c0 WARN                 basesrc<br>
gstbasesrc.c:2378:gst_base_src_loop:&lt;appsrc&gt; error: Internal data flow<br>
error.<br>
0:00:00.149971963 22049  0x94e42c0 WARN                 basesrc<br>
gstbasesrc.c:2378:gst_base_src_loop:&lt;appsrc&gt; error: streaming task paused,<br>
reason not-negotiated (-4)<br>
<br>
(rxpipeline:22049): GStreamer-CRITICAL **: gst_mini_object_unref: assertion<br>
`mini_object-&gt;refcount &gt; 0&#39; failed<br>
<br>
I have attached the source code below. Please also note that if I remove the<br>
resample element and caps filter from the pipeline, I can successfully push<br>
and pull the buffer.<br>
<br>
Any help would be greatly appreciated.  Thanks.<br>
<br>
Best regards,<br>
<br>
Nadeem<br>
<br>
---------------------------------------------<br>
#include &lt;gst/gst.h&gt;<br>
#include &lt;gst/app/gstappbuffer.h&gt;<br>
#include &lt;gst/app/gstappsrc.h&gt;<br>
#include &lt;gst/app/gstappsink.h&gt;<br>
<br>
#define BUFFER_SIZE 160<br>
<br>
int main (int argc, char *argv[])<br>
{<br>
  GstBuffer *app_buffer_src, *app_buffer_sink;<br>
  GMainLoop *loop;<br>
<br>
  GstElement *pipeline;<br>
  GstElement *appsrc;<br>
  GstElement *appsink;<br>
  GstElement *audiores;<br>
  GstElement *capsfilt_res;<br>
<br>
  // initialize<br>
<br>
  gst_init(&amp;argc, &amp;argv);<br>
<br>
  // create elements<br>
<br>
  loop           = g_main_loop_new (NULL, FALSE);<br>
  pipeline       = gst_pipeline_new(NULL);<br>
  appsrc         = gst_element_factory_make(&quot;appsrc&quot;,&quot;appsrc&quot;);<br>
  appsink        = gst_element_factory_make(&quot;appsink&quot;,&quot;appsink&quot;);<br>
  audiores       = gst_element_factory_make(&quot;audioresample&quot;,&quot;audiores&quot;);<br>
  capsfilt_res   = gst_element_factory_make(&quot;capsfilter&quot;,&quot;capsfilt_res&quot;);<br>
<br>
  // setup pipeline<br>
<br>
  GstCaps *rescaps;<br>
  rescaps = gst_caps_new_simple(&quot;audio/x-raw-int&quot;, &quot;rate&quot;, G_TYPE_INT,<br>
(gint)48000, NULL);<br></blockquote><div><br>I think your problem is here, you have to specify the full caps, the not negotiated error is right, appsrc cant tell you the kind of data you are streaming and your caps only says that it is int with a 48000 rate... but how much channels? and the depth/ width of the samples? you must give full caps or the pipeline is unable to verify what kind of data you are streaming. Only appsrc/appsink works because they don&#39;t need to know the kind of data that you are streaming, so they can negotiate with each other, but audioresample need full caps of the stream to work.<br>
<br>Hope this helps ;)<br><br>Someone correct me if i said something wrong.<br><br>best regards,<br>Katcipis<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

  g_object_set(capsfilt_res,&quot;caps&quot;,rescaps,NULL);<br>
<br>
  gst_bin_add_many (GST_BIN<br>
(pipeline),appsrc,appsink,audiores,capsfilt_res,NULL);<br>
<br>
  gboolean res;<br>
  res = gst_element_link_many(appsrc,audiores,capsfilt_res,appsink,NULL);<br>
  g_assert (res == TRUE);<br>
<br>
  gst_element_set_state(pipeline,GST_STATE_PLAYING);<br>
<br>
  // create buffer<br>
<br>
  gpointer raw_buffer;<br>
  raw_buffer = g_malloc0(BUFFER_SIZE);<br>
<br>
  int ii = 0;<br>
  for (ii=0; ii&lt;BUFFER_SIZE; ii++)<br>
  {<br>
     ((guint8*)raw_buffer)[ii] = (guint8)ii;<br>
  }<br>
<br>
  // push buffer to pipeline via appsrc<br>
<br>
  GstCaps *caps;<br>
  caps = gst_caps_new_simple(&quot;audio/x-raw-int&quot;, &quot;width&quot;, G_TYPE_INT,<br>
(gint)8, &quot;depth&quot;, G_TYPE_INT, (gint)8, &quot;channels&quot; ,G_TYPE_INT, (gint)1,<br>
<br>
&quot;rate&quot;,G_TYPE_INT,8000,&quot;endianness&quot;,G_TYPE_INT,(gint)1234,NULL);<br>
<br>
  app_buffer_src = gst_app_buffer_new (raw_buffer, BUFFER_SIZE, g_free,<br>
raw_buffer);<br>
  GST_BUFFER_CAPS(app_buffer_src) = caps;<br>
<br>
  gst_app_src_push_buffer(GST_APP_SRC(appsrc),app_buffer_src);<br>
  gst_buffer_unref (app_buffer_src);<br>
<br>
  // read buffers from pipeline via appsink<br>
<br>
  app_buffer_sink = gst_app_sink_pull_buffer(GST_APP_SINK(appsink));<br>
<br>
  for (ii = 0; ii&lt;GST_BUFFER_SIZE(app_buffer_sink); ii++ )<br>
  {<br>
    printf(&quot;data(ii) %d\n&quot;,GST_BUFFER_DATA(app_buffer_sink)[ii]);<br>
  }<br>
<br>
  // cleanup<br>
<br>
  gst_element_set_state(pipeline,GST_STATE_NULL);<br>
  gst_object_unref(GST_OBJECT(pipeline));<br>
<br>
<br>
  return 0;<br>
<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://n4.nabble.com/issue-with-appsrc-and-audioresample-tp1572395p1572395.html" target="_blank">http://n4.nabble.com/issue-with-appsrc-and-audioresample-tp1572395p1572395.html</a><br>

Sent from the GStreamer-devel mailing list archive at Nabble.com.<br>
<br>
------------------------------------------------------------------------------<br>
Download Intel® Parallel Studio Eval<br>
Try the new software tools for yourself. Speed compiling, find bugs<br>
proactively, and fine-tune applications for parallel performance.<br>
See why Intel Parallel Studio got high marks during beta.<br>
<a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
</blockquote></div><br>