<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">I'm not entirely sure I understand your description of the problem...<div><br></div><div>but you wouldn't be able to re-use a GstBuffer (or what the 'data' member points to), until the last unref. &nbsp;Perhaps if you are trying to re-use the same buffer while other parts of the pipeline still hold a ref to it, this would be causing problems.</div><div><br></div><div>BR,</div><div>-R</div><div><br></div><div><br></div><div><div><div>On Jan 9, 2010, at 4:24 AM, Chen, Weian wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>



<div lang="ZH-CN" link="blue" vlink="blue" style="word-wrap: break-word;-webkit-nbsp-mode: space;
-webkit-line-break: after-white-space">

<div class="Section1"><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial"><o:p>&nbsp;</o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial">Thanks a lot for your information/suggestion.<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial"><o:p>&nbsp;</o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial">And I have made some experiments, and found that: I
have to create new GstBuffer for every gst_pad_push() in _chain(), once the
GstBuffer is used, it could not push data to downstream element successfully,
the pipeline still keeps running, but the data in GstBuffer can’t be written
into file.<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial"><o:p>&nbsp;</o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial">Please note, I mean I need to create GstBuffer for
each call of _chain(), but not the real buffer which will contain real data (GstBufer’s
member variable <i><span style="font-style:italic">-&gt;data</span></i> will
point this buffer)<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial"><o:p>&nbsp;</o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial">What’s the problem?<o:p></o:p></span></font></p><p class="MsoNormal"><font size="2" face="Arial"><span lang="EN-US" style="font-size:
10.0pt;font-family:Arial"><o:p>&nbsp;</o:p></span></font></p>

<div><p class="MsoNormal"><font size="2" color="blue" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial;color:blue">thanks,</span></font><span lang="EN-US"><o:p></o:p></span></p><p class="MsoNormal"><font size="2" color="blue" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial;color:blue">Weian</span></font><span lang="EN-US"><o:p></o:p></span></p>

</div>

<div>

<div class="MsoNormal" align="center" style="text-align:center"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">

<hr size="2" width="100%" align="center" tabindex="-1">

</span></font></div><p class="MsoNormal"><b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">From:</span></font></b><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">
Clark, Rob [mailto:rob@ti.com] <br>
<b><span style="font-weight:bold">Sent:</span></b> 2010</span></font><font size="2" face="宋体"><span style="font-size:10.0pt;font-family:SimSun">年</span></font><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">1</span></font><font size="2" face="宋体"><span style="font-size:10.0pt;font-family:SimSun">月</span></font><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">9</span></font><font size="2" face="宋体"><span style="font-size:10.0pt;font-family:SimSun">日</span></font><font size="2" face="Tahoma"><span lang="EN-US" style="font-size:10.0pt;font-family:Tahoma">
17:55<br>
<b><span style="font-weight:bold">To:</span></b> Discussion of the development
of GStreamer<br>
<b><span style="font-weight:bold">Subject:</span></b> Re: [gst-devel] Question
on how to use GstBuffer?</span></font><span lang="EN-US"><o:p></o:p></span></p>

</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">yes, there are a handful of examples of this..
&nbsp;look for example, in v4l2bufferpool.. &nbsp;xvimagesink, etc..<o:p></o:p></span></font></p>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">basically the principle is to subclass GstBuffer,
provide your own finalize function that revives the buffer and returns it to
your pool of buffers.<o:p></o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">(random thought: &nbsp;really, it's a pattern seen in
enough gst elements, that perhaps it would be nice to see a generic
GstBufferPool class..)<o:p></o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">BR,<o:p></o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">-R<o:p></o:p></span></font></p>

</div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><o:p>&nbsp;</o:p></span></font></p>

<div>

<div>

<div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt">On Jan 7, 2010, at 8:56 PM, <st1:personname w:st="on">Chen,
 Weian</st1:personname> wrote:<o:p></o:p></span></font></p>

</div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"><br>
<br>
<o:p></o:p></span></font></p>

<span style="orphans: 2;widows: 2;-webkit-border-horizontal-spacing: 0px;
-webkit-border-vertical-spacing: 0px;-webkit-text-decorations-in-effect: none;
-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:
0px">

<div link="blue" vlink="purple">

<div><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial">Hi
All,<u1:p></u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:
10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial"><u1:p>&nbsp;</u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial">In
my current element, I will create and new a GstBuffer (which means to use
g_malloc to allocate buffer) in the _chain() function for each frame.<u1:p></u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial"><u1:p>&nbsp;</u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial">My
question is: Can I allocate several buffers (ring buffers) ahead of time, then
I can re-use them and don’t need to allocate buffer for each call of _chain, if
yes, how?<u1:p></u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial"><u1:p>&nbsp;</u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial">Thanks
in advanced.<u1:p></u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" face="Arial"><span lang="EN-US" style="font-size:10.0pt;font-family:Arial"><u1:p>&nbsp;</u1:p></span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><o:p></o:p></span></font></p><p class="MsoNormal" style="text-align:justify;text-justify:inter-ideograph"><font size="2" color="blue" face="Arial"><span lang="EN-US" style="font-size:10.0pt;
font-family:Arial;color:blue">Weian</span></font><font size="2"><span lang="EN-US" style="font-size:10.5pt"><u1:p></u1:p><o:p></o:p></span></font></p>

</div><p class="MsoNormal"><font size="4" face="Helvetica"><span lang="EN-US" style="font-size:13.5pt;font-family:Helvetica">------------------------------------------------------------------------------<br>
This<span class="apple-converted-space">&nbsp;</span><a href="http://SF.Net/">SF.Net</a><span class="apple-converted-space">&nbsp;</span>email is sponsored by the Verizon
Developer Community<br>
Take advantage of Verizon's best-in-class app development support<br>
A streamlined, 14 day to market process makes app distribution fast and easy<br>
Join now and get one step closer to millions of Verizon customers<br>
<a href="http://p.sf.net/sfu/verizon-dev2dev">http://p.sf.net/sfu/verizon-dev2dev</a><span class="apple-converted-space">&nbsp;</span>_______________________________________________<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">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><o:p></o:p></span></font></p>

</div>

</span></div><p class="MsoNormal"><font size="3" face="Times New Roman"><span lang="EN-US" style="font-size:12.0pt"></span><o:p>&nbsp;</o:p></font></p>

</div>

</div>

</div>

</div>


------------------------------------------------------------------------------<br>This <a href="http://SF.Net">SF.Net</a> email is sponsored by the Verizon Developer Community<br>Take advantage of Verizon's best-in-class app development support<br>A streamlined, 14 day to market process makes app distribution fast and easy<br>Join now and get one step closer to millions of Verizon customers<br><a href="http://p.sf.net/sfu/verizon-dev2dev">http://p.sf.net/sfu/verizon-dev2dev</a> _______________________________________________<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">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br></o:smarttagtype></blockquote></div><br></div></body></html>