Dears, <br><br>I found the reason why my buffer_alloc() is not called. <br>So I answer this question by myself and for your reference if some body needs it.<br><br>At first, I used the udpsrc as my source, but udpsrc malloc the buffer itself, and doesn&#39;t use gst_pad_alloc_buffer(). gst_pad_alloc_buffer() will invoke the sink&#39;s buffer_alloc() function.<br>
<br>It is independent of pull-mode or push-mode.<br><br>The source, videotestsrc, is an example to use gst_pad_alloc_buffer().<br><br>France Hsu<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br>
<br>
Hi! Tim,<br>
<br>
Thanks for your reply.<br>
I would misunderstand the meaning of &quot;pull-mode sink&quot;.<br>
You mean, pull-mode and buffer allocated by sink are two different things,<br>
right?<br>
<br>
In the fact, my sink is for a HW device, so I want the source to use the HW<br>
buffer (allocated in sink) for data flow, not to allocate by source itself.<br>
<br>
I wish to use udpsrc for the pipeline, and found it is based on GstPushSrc.<br>
(Therefore, I thought I should implement a pull-based sink, and find a<br>
pull-based source)<br>
$ gst-launch udpsrc udp://IP:PORT ! mysink<br>
<br>
However, my buffer_alloc function is not called.<br>
<br>
France Hsu<br>
<br>
<br>
&gt; Hi,<br>
&gt;<br>
&gt; &gt; I&#39;m a newbie for gstreamer and  working on a sink that I wish it would<br>
&gt; &gt; provide buffer for source. I think it would be a pull-based sink.<br>
&gt; &gt;  (...)<br>
&gt; &gt; I implemented this sink based on base-sink, and added the virtual<br>
&gt; &gt; function: buffer_alloc() (gst_my_sink_buffer_alloc) and render()<br>
&gt; &gt; (gst_my_sink_render).<br>
&gt;<br>
&gt; What kind of sink is this?<br>
&gt;<br>
&gt; There&#39;s no need for the sink to operate in pull mode to be able to<br>
&gt; provide buffers to upstream. It should be sufficient to implement a<br>
&gt; buffer alloc function.<br>
&gt;<br>
&gt; Take for example:<br>
&gt;<br>
&gt;  $ GST_DEBUG=*src:5,*sink:5 videotestsrc num-buffers=2 ! ximagesink<br>
&gt;<br>
&gt; This will operate in push mode, but videotestsrc will call<br>
&gt; gst_pad_alloc_buffer() to get a buffer from ximagesink and then fill<br>
&gt; that with data and push it back to ximagesink.<br>
&gt;<br>
&gt; Pull mode for sinks is something that&#39;s not really used much in practice<br>
&gt; and is rarely useful. Maybe you could provide some more details of what<br>
&gt; you&#39;re trying to do?<br>
&gt;<br>
&gt;  Cheers<br>
&gt;  -Tim<br>
&gt;<br>
&gt;<br></blockquote></div>