how to release the GstBuffer memory
trinadh Pala
me_wavelet at yahoo.co.uk
Wed Jun 26 02:26:26 PDT 2013
Hello All,
Did you notice any memory leak problems with the "tsdemux" library component? Just trying to figure out whether the memory leak in my application is happening while using the appsrc buffers or from the next state element.
Thanks and regards
Trinadh
________________________________
From: trinadh Pala <me_wavelet at yahoo.co.uk>
To: Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Sent: Wednesday, 26 June 2013, 10:21
Subject: Re: how to release the GstBuffer memory
Hello Martin,
Thanks for your reply. I will try to install the appsrc library and see. I will now mix QtGstreamer libraries and gst libraries and see. As you mentioned, QtGstreamer is only a wrapper around the gstreamer library. As I had mentioned in my earlier mail QGst::Buffer::create() is creating and allocating but did not notice any g_free mentioned in that function. The appsrc library I was using was in Qt gstreamer utils. now I have to see how to get this gst/appsrc.
I wish someone doing the QtGstreamer wrapper library responds to the question.
Many thanks
Trinadh.
________________________________
From: Angel Martin <amartin at vicomtech.org>
To: trinadh Pala <me_wavelet at yahoo.co.uk>; Discussion of the development of and with GStreamer <gstreamer-devel at lists.freedesktop.org>
Sent: Wednesday, 26 June 2013, 8:06
Subject: Re: how to release the GstBuffer memory
As far as i understood you can mix gstreamer baseline code with QT and
use QT Objects as sinks but I've never used QT wrapper of gstreamer.
The code that I posted fixes the memory leak for sure.
2013/6/25 trinadh Pala <me_wavelet at yahoo.co.uk>:
> Hello Angel Martin &
all,
>
> 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.
>
> Thanks and regards
> Trinadh
>
>
>
________________________________
> From: Angel Martin <amartin at vicomtech.org>
> To: trinadh Pala <me_wavelet at yahoo.co.uk>; Discussion of the development of
> and with GStreamer <gstreamer-devel at lists.freedesktop.org>
> Sent: Tuesday, 25 June 2013, 16:21
> Subject: Re: how to release the GstBuffer memory
>
> Hi,
>
> Here you will find the proper way:
>
> http://users.design.ucla.edu/~acolubri/test/gstreamer/appsrc_filesink.c
> /* used to inject a new buffer into the pipeline */
>
static void
> inject_new_buffer_into_pipeline (ProgramData * data)
> {
> guint size;
> gpointer raw_buffer;
> GstBuffer *app_buffer;
> GstElement *source;
>
> size = 80 * 60 * 4; // 80x60 pixels, 32 bpp.
> g_print ("Pushing a buffer of size %d\n", size);
>
> // Allocating the memory for the buffer.
> raw_buffer = g_malloc0 (size);
>
> app_buffer = gst_app_buffer_new (raw_buffer, size, g_free, raw_buffer);
>
> /* newer basesrc will set caps for use automatically but it does not
> really
> * hurt to set it on the buffer again */
> gst_buffer_set_caps (app_buffer, gst_caps_from_string (video_caps));
>
> /* get source an push new buffer */
> source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
>
gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
> }
>
> 2013/6/25 trinadh Pala <me_wavelet at yahoo.co.uk>:
>> Hello,
>>
>> I am writing an application using QtGstreamer library.
>>
>> I am implemeting a media player application. i am using Appsource for
>> linking the source. The data is available in a char *buffer.
>>
>> I created a buffer using QGst::Buffer::create(size).
>> // pBuf has the Transport stream data char *pBuf
>> // This piece of code is in a loop.
>>
>> QGst::BufferPtr m_buffer;
>> m_buffer=QGst::Buffer::create(buf_size);
>>
>> quint8 *m_data_ptr=m_buffer->data();
>>
>>
memcpy(m_data_ptr,pBuf,buf_size);
>>
>> if(this->m_player->m_pipeline);
>>
>> ret = this->m_player->m_appsrc.pushBuffer(m_buffer);
>>
>> if (!m_buffer.isNull())
>> {
>> if (ret != QGst::FlowOk)
>> {
>> /* some error, stop sending data */
>> qDebug("some error");
>> }
>> else
>> {
>> qDebug("pushed a buffer
successfully");
>>
>> }
>> }
>>
>>
>> The method works, i am able to display the video. However, I did not know
>> how to release the buffer created. so the application leaks memory. How to
>> release the Buffer, after pushBuffer. Please help.
>>
>> Thanks and regards
>> Trinadh
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>>
>
_______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130626/d2415d5e/attachment-0002.html>
More information about the gstreamer-devel
mailing list