how to create the caps for udpsrc element in gstreamer?-Collection of common programming errors

I want to be run the audio pipeline using udpsrc element. I am going to set the caps (capabilities) of udpsrc for example gst-launch-0.10 -vvv udpsrc multicast-iface=eth0 uri=udp://239.255.255.6:25012 caps=“application/x-rtp, media=(string)audio, payload=(int)96,clock-rate=(int)16000, encoding-name=(string)MPEG4-GENERIC,streamtype=(string)5,profile-level-id=(string)15,mode=(string)AAC-hbr,config=(string)1408,sizelength=(string)13, indexlength=(string)3,indexdeltalength=(string)3” to set this caps in program i using

g_object_set(G_OBJECT(Source),"caps",gst_caps_new_simple ("application/x-rtp",
                    "media", G_TYPE_STRING, "audio",
                    "payload",G_TYPE_INT,96,
                    "clock-rate", G_TYPE_INT, 16000,
                    "encoding-name", G_TYPE_STRING,"MPEG4-GENERIC",
                    "streamtype",G_TYPE_STRING,"5",
                    "profile-level-id", G_TYPE_STRING,"15",
                    "mode",G_TYPE_STRING,"AAC-hbr",
                    "config",G_TYPE_STRING,"1408",
                    "sizelength",G_TYPE_STRING,"13",
                    "indexlength",G_TYPE_STRING,"3"
                    "indexdeltalength",G_TYPE_STRING,"3",
                    NULL),NULL);

But it shows a segmentation fault so please tell me as soon as possible what to do?…..

  1. The code look okay (although you leak the caps). To fix the leak do:

    GstCaps *caps = gst_caps_new_simple( ....);
    g_object_set(source, "caps", caps, NULL);
    gst_caps_unref(caps);
    

    To figure out why it segfaults run the app under gdb:

    G_DEBUG="fatal_warnings" gdb --args ./my-app 
    

    Inside gdb “run” and when it crashed type “bt” to show the backtrace.