GNOME Bugzilla – Bug 683476
Segmentation Fault observed
Last modified: 2012-09-06 10:42:33 UTC
When I call the following functions for getting the position gst_element_query_position (pipeline, GST_FORMAT_TIME, &pos) gst_element_query_duration (pipeline, GST_FORMAT_TIME, &len) I see the segmentation fault. I am using the helloworld application at path http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-helloworld.html#section-helloworld in which I have registered the callback for every 1000 ms. In this callback I call the above functions. Please tell me what can be possible reason behind this. I have seen with running the gdb and could see the call back but of no use. -Viranjan
You need to us the code of your callback. My guess is that you define pos and len wrongly.
Please provide all the code that you added, so we can see the context. Also, please provide a stack trace for the crash (from gdb).
Created attachment 223622 [details] The code in which I am seeing the segmentation fault.... The code in which I am seeing the segmentation fault....
Please find attached file for the code. stack trace comes till query functions from main and nothing thereafter.
The bug is in your code: if (gst_element_query_position (pipeline, (GstFormat *)GST_FORMAT_TIME, &pos) You can't just cast like that, it needs to be (in 0.10): GstFormat format = GST_FORMAT_TIME; if (gst_element_query_position (pipeline, &formt, &pos)) { ... } I'm sure you could have found working sample code somewhere ;) (Admittedly the API is a bit weird, we've fixed it in 1.0).
Thanks a lot for such a fast resolution :-)