{"id":2124,"date":"2022-08-30T15:22:15","date_gmt":"2022-08-30T15:22:15","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/01\/02\/how-to-create-the-caps-for-udpsrc-element-in-gstreamer-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:22:15","modified_gmt":"2022-08-30T15:22:15","slug":"how-to-create-the-caps-for-udpsrc-element-in-gstreamer-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-to-create-the-caps-for-udpsrc-element-in-gstreamer-collection-of-common-programming-errors\/","title":{"rendered":"how to create the caps for udpsrc element in gstreamer?-Collection of common programming errors"},"content":{"rendered":"<p>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=<strong>&#8220;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&#8221;<\/strong> to set this caps in program i using<\/p>\n<pre><code>g_object_set(G_OBJECT(Source),\"caps\",gst_caps_new_simple (\"application\/x-rtp\",\n                    \"media\", G_TYPE_STRING, \"audio\",\n                    \"payload\",G_TYPE_INT,96,\n                    \"clock-rate\", G_TYPE_INT, 16000,\n                    \"encoding-name\", G_TYPE_STRING,\"MPEG4-GENERIC\",\n                    \"streamtype\",G_TYPE_STRING,\"5\",\n                    \"profile-level-id\", G_TYPE_STRING,\"15\",\n                    \"mode\",G_TYPE_STRING,\"AAC-hbr\",\n                    \"config\",G_TYPE_STRING,\"1408\",\n                    \"sizelength\",G_TYPE_STRING,\"13\",\n                    \"indexlength\",G_TYPE_STRING,\"3\"\n                    \"indexdeltalength\",G_TYPE_STRING,\"3\",\n                    NULL),NULL);\n<\/code><\/pre>\n<p>But it shows a segmentation fault so please tell me as soon as possible what to do?&#8230;..<\/p>\n<ol>\n<li>\n<p>The code look okay (although you leak the caps). To fix the leak do:<\/p>\n<pre><code>GstCaps *caps = gst_caps_new_simple( ....);\ng_object_set(source, \"caps\", caps, NULL);\ngst_caps_unref(caps);\n<\/code><\/pre>\n<p>To figure out why it segfaults run the app under gdb:<\/p>\n<pre><code>G_DEBUG=\"fatal_warnings\" gdb --args .\/my-app \n<\/code><\/pre>\n<p>Inside gdb &#8220;run&#8221; and when it crashed type &#8220;bt&#8221; to show the backtrace.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2014-01-02 12:07:15. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>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=&#8220;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&#8221; to set this caps in program i using g_object_set(G_OBJECT(Source),&#8221;caps&#8221;,gst_caps_new_simple (&#8220;application\/x-rtp&#8221;, &#8220;media&#8221;, G_TYPE_STRING, &#8220;audio&#8221;, &#8220;payload&#8221;,G_TYPE_INT,96, &#8220;clock-rate&#8221;, G_TYPE_INT, 16000, &#8220;encoding-name&#8221;, G_TYPE_STRING,&#8221;MPEG4-GENERIC&#8221;, &#8220;streamtype&#8221;,G_TYPE_STRING,&#8221;5&#8243;, &#8220;profile-level-id&#8221;, G_TYPE_STRING,&#8221;15&#8243;, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2124","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2124"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2124\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}