[gst-devel] Gdb - help with debbug
Guilherme
grlongo.ireland at gmail.com
Thu May 7 01:59:58 CEST 2009
Hi all.
I finished building my code and it's compiled without any error, but
when I run it I get the beautiful segmentation fault.
No good.
Running gdb I can't get the line of the problem, instead I have this:
(gdb) run
Starting program: /home/guilherme/EBA
[Thread debugging using libthread_db enabled]
[New Thread 0xb7a479b0 (LWP 5565)]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7a479b0 (LWP 5565)]
0xb7bf2234 in ?? () from /usr/lib/libgstfft-0.10.so.0
Is this a normal debug or I'm doing smth wrong?
It seen a problem with my fft implementation. That is the code:
#include<gst/gst.h>
#include<glib.h>
#include<gst/fft/gstffts16.h>
static gboolean bus_call(GstBus *bus, GstMessage *msg,
gpointer data);
int main(int argc, char *argv[])
{
GMainLoop *loop;
GstElement *pipeline, *source, *filesink;
GstBus *bus;
GstBuffer *buffer;
GstFFTS16 *fft;
const gint16 *in;
GstFFTS16Complex *freq;
gst_init(&argc, &argv);
loop = g_main_loop_new (NULL, FALSE);
/*creating elements*/
pipeline = gst_pipeline_new ("audio-player");
source = gst_element_factory_make ("audiotestsrc",
"file-source");
filesink = gst_element_factory_make ("alsasink",
"audio-output");
fft = gst_fft_s16_new (128, FALSE);
if (!pipeline || !source || !filesink) {
g_printerr ("One element could not be created.
Exiting.\n");
return -1;
}
/*set-up the pipeline*/
/*create and set up buffer*/
g_print ("\n\nCreating Buffer\n");
buffer = gst_buffer_new();
if(!buffer)
g_printerr ("buffer could not be created\n");
else
g_print ("Buffer Created\n\n");
/*set up fft transform*/
gst_fft_s16_fft (fft, in, freq);
/*message handler*/
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
gst_bus_add_watch (bus, bus_call, loop);
gst_object_unref (bus);
/*colocar todos elementos na pipeline*/
gst_bin_add_many (GST_BIN (pipeline), source, filesink, NULL);
/*Linkar elementos*/
/*Cria o link entre os pads dos elementos*/
gst_element_link_many (source, filesink, NULL);
/* set pipeline playing status */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
g_print ("Running...\n");
/*iterate*/
g_main_loop_run (loop);
g_print ("Recording\n");
/* Out of the main loop, clean up nicely */
g_print ("Returned, stopping playback\n");
gst_element_set_state (pipeline, GST_STATE_NULL);
g_print ("Deleting pipeline\n");
gst_object_unref (GST_OBJECT (pipeline));
return 0;
}
static gboolean bus_call(GstBus *bus, GstMessage *msg,
gpointer data) {
return TRUE;
}
More information about the gstreamer-devel
mailing list