<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style><!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Found the issue. Rookie mistake gst_buffer_unmap() was missing in the _fill() routine<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:10.0pt;
font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;
font-family:"Tahoma","sans-serif""> gstreamer-devel [mailto:gstreamer-devel-bounces@lists.freedesktop.org]
<b>On Behalf Of </b>Spruyt, Randy<br>
<b>Sent:</b> Wednesday, May 06, 2015 2:48 PM<br>
<b>To:</b> Discussion of the development of and with GStreamer<br>
<b>Subject:</b> memory not being freed?<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Hey Everyone,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">This is my first source filter. The filter “produces” H.264 frames (from the nvidia frame buffer capture api). The frames show up in the d3dvideosink renderer correctly. When using a fakesink, memory usage is stable.
 However,  when using a avdec_h264 ! d3dvideosink, memory usage continually grows.
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">The only function we override from the base source class is the _fill() function.
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">If we have the _fill function do nothing and simply return GST_FLOW_OK, we have the same memory gowth problem, suggesting there is some kind of frame information missing designating the end of the frame. It seems
 like the element is holding on to the buffer and waiting for the remaining data in a subsequent buffer, that is never received, and thus the previous buffers are never freed. Everything renders correctly when using avdec_h264 ! d3dvideosink.<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">The question is: What is gstreamer looking for? What does it need to release the buffer references to previous frames so they can be freed? Maybe the caps are defined incorrectly?<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Memory usage is fine:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">gst-launch-1.0 christiedesktopcapturefilter ! fakesink<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Memory usage grows continually:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Gst-launch-1.0 christiedesktopcapturefilter ! avdec_h264 ! fakesink<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Gst-launch-1.0 christiedesktopcapturefilter ! h264parse ! fakesink<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Gst-launch-1.0 christiedesktopcapturefilter ! avdec_h264 ! d3dvideosink<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Cheers,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:.5in">Randy<o:p></o:p></p>
</div>
</body>
</html>