Stack memory issue with gstreamer
jbvulai
jb.vu.lai at gmail.com
Wed Apr 30 14:07:47 PDT 2014
Hi,
I have a memory issue concerning an QT embedded app that is running
gstreamer. I have a simple audio pipeline that plays multiple wav files one
after the other. I am doing so by detecting the EOS signal on the bus and
during this callback, I change my file source and start the playback on the
next file. Once all files have been played, the entire list is looped again.
(code is annexed at the end) All of this, using the same pipeline.
After awhile, the application loses responsiveness and eventually crashes.
I've noticed that while gstreamer is playing, the stack memory increases
steadily as if a certain portion of the stack is never freed. (see attached
Valgrind Massif reports) This is usually a symptom of deep recursion.
After playing with different ways of running gstreamer (different ways of
looping, reducing calls to the api), i've noticed that how fast the stack
memory fills is directly proportional to the number of gst_element_set_state
calls. But even if i call it once... or just set the pipeline state to NULL
in a loop or with QT support for g_loop, the symptoms are the same.
All files are relatively small (< 15s and audio/x-raw-int, signed=false,
width=8, depth=8, rate=8000, channels=1) and this issue has been observed
with both Gstreamer 0.10 and 1.0.
My colleagues and I have on this for quite some time and would really need
help on this.
Thank you!
J.B.
Here is my bus callback function :
<code>
int AudioVoiceService::playbus_callback(GstBus *bus, GstMessage *msg,
gpointer data)
{
PlaybackStream* ps = (PlaybackStream*) data;
switch (GST_MESSAGE_TYPE(msg))
{
case GST_MESSAGE_EOS:
//Next file source index + Detect end of playlist
if (++(ps->currentSourceIndex) >= ps->filesources.size())
{
ps->currentSourceIndex = 0;
//Stop playback loop if repeat not enabled
if (!ps->isRepeat)
{
gst_element_set_state(ps->pipeline, GST_STATE_NULL);
ps->filesources.clear();
ps->isPlaybackPlaying = false;
break;
}
}
gst_element_set_state(ps->pipeline, GST_STATE_NULL);
if (gst_element_get_state(ps->pipeline, NULL, NULL,
GST_CLOCK_TIME_NONE) == GST_STATE_CHANGE_SUCCESS); //check if state change
is done
{
//Change file source
g_object_set(ps->source, "location",
ps->filesources[ps->currentSourceIndex].c_str(), NULL);
//Play new file
gst_element_set_state(ps->pipeline, GST_STATE_PLAYING);
}
break;
default:
break;
}
return 1;
}
</code>
<http://gstreamer-devel.966125.n4.nabble.com/file/n4666681/Massif-gst0.png>
<http://gstreamer-devel.966125.n4.nabble.com/file/n4666681/Massif-gst1.png>
<http://gstreamer-devel.966125.n4.nabble.com/file/n4666681/Massif-aa128-gst0.png>
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Stack-memory-issue-with-gstreamer-tp4666681.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list