<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt">Hello Angel Martin & all,<br><br>I have gone through the program that was in the link below. This program is playing some 300 video frames and after that it stops. So if there is any memory leak, it may not be able to indicate. So I am not sure whether this program has been tested for memory leak. It is not clear to me how the buffer release was implemented. If I call g_free(pointer). or m_buffer->clear in my program after pushing the buffer to the pipeline, the program exits. if I do not use g_free or m_buffer->clear then the program continues to send the ts data to the down stream elemets and decoding happens properly except for the problem of leaking memory. I am stuck with the problem for a couple of day, the application is no use without fixing this memory leak. Please help.<br><br>Thanks and
 regards<br>Trinadh<br><div><span><br></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Angel Martin <amartin@vicomtech.org><br> <b><span style="font-weight: bold;">To:</span></b> trinadh Pala <me_wavelet@yahoo.co.uk>; Discussion of the development of and with GStreamer <gstreamer-devel@lists.freedesktop.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, 25 June 2013, 16:21<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: how to release the GstBuffer memory<br> </font> </div> <div class="y_msg_container"><br>Hi,<br><br>Here you will find the proper way:<br><br><a href="http://users.design.ucla.edu/~acolubri/test/gstreamer/appsrc_filesink.c"
 target="_blank">http://users.design.ucla.edu/~acolubri/test/gstreamer/appsrc_filesink.c</a><br>/* used to inject a new buffer into the pipeline */<br>static void<br>inject_new_buffer_into_pipeline (ProgramData * data)<br>{<br>  guint size;<br>  gpointer raw_buffer;<br>  GstBuffer *app_buffer;<br>  GstElement *source;<br><br>  size = 80 * 60 * 4; // 80x60 pixels, 32 bpp.<br>  g_print ("Pushing a buffer of size %d\n", size);<br><br>  // Allocating the memory for the buffer.<br>  raw_buffer = g_malloc0 (size);<br><br>  app_buffer = gst_app_buffer_new (raw_buffer, size, g_free, raw_buffer);<br><br>  /* newer basesrc will set caps for use automatically but it does not really<br>   * hurt to set it on the buffer again */<br>  gst_buffer_set_caps (app_buffer, gst_caps_from_string (video_caps));<br><br>  /* get source an push new buffer */<br>  source = gst_bin_get_by_name (GST_BIN
 (data->sink), "testsource");<br>  gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);<br>}<br><br>2013/6/25 trinadh Pala <<a ymailto="mailto:me_wavelet@yahoo.co.uk" href="mailto:me_wavelet@yahoo.co.uk">me_wavelet@yahoo.co.uk</a>>:<br>> Hello,<br>><br>> I am writing an application using QtGstreamer library.<br>><br>> I am implemeting a media player application. i am using Appsource for<br>> linking the source. The data is available in a char *buffer.<br>><br>> I created  a buffer using  QGst::Buffer::create(size).<br>> // pBuf has the Transport stream data char *pBuf<br>> // This piece of code is in a loop.<br>><br>>   QGst::BufferPtr m_buffer;<br>>    m_buffer=QGst::Buffer::create(buf_size);<br>><br>>    quint8 *m_data_ptr=m_buffer->data();<br>><br>>    memcpy(m_data_ptr,pBuf,buf_size);<br>><br>>   
 if(this->m_player->m_pipeline);<br>><br>>           ret = this->m_player->m_appsrc.pushBuffer(m_buffer);<br>><br>>         if (!m_buffer.isNull())<br>>             {<br>>         if (ret != QGst::FlowOk)<br>>                 {<br>>         /* some error, stop sending data */<br>>                 qDebug("some error");<br>>                 }<br>>             else<br>>                 {<br>>                 qDebug("pushed a buffer successfully");<br>><br>>                 }<br>>            
 }<br>><br>><br>> The method works, i am able to display the video. However, I did not know<br>> how to release the buffer created. so the application leaks memory. How to<br>> release the Buffer, after pushBuffer. Please help.<br>><br>> Thanks and regards<br>> Trinadh<br>><br>> _______________________________________________<br>> gstreamer-devel mailing list<br>> <a ymailto="mailto:gstreamer-devel@lists.freedesktop.org" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>> <a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>><br>_______________________________________________<br>gstreamer-devel mailing list<br><a ymailto="mailto:gstreamer-devel@lists.freedesktop.org" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br><a
 href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br><br><br></div> </div> </div>  </div></body></html>