Setting Source port of udp sink

Tobias abue.gst.dev at googlemail.com
Wed Feb 8 04:38:58 PST 2012


I also encountered the exactly same problem, is there any solution to
set the SOURCE PORT of UDPSink? When using sockfd it throws the
mentioned error:

"Error: Could not get/set settings from/on resource."

Would be great if someone has a solution for this?


Am 28.11.2011 07:37, schrieb Sunil:
> Hi All,
>
>         Requesting help from all of you in resolving this issue.
>
> Thanks and Regards,
> Sunil
>
>
> On Friday 25 November 2011 05:39 PM, Sunil wrote:
>>
>> Hi All,
>>
>>     I am trying to set the source port of udpsink using external
>> socked fd.But i am getting error  as "Could not get/set settings
>> from/on resource".
>> Please find the code for the same below.Request you all to help me
>> fix the issue.
>>
>> Code:
>> ---------------------------------------------------------------------------
>>
>>      /* create and bind a socket for RTP and RTCP */
>>         memset(&rtp_addr, 0, sizeof(struct sockaddr_in));
>>         rtp_sockfd = socket (AF_INET, SOCK_DGRAM, 0);
>>         if (rtp_sockfd > 0 ) {
>>                 int res;
>>                 rtp_addr.sin_family = AF_INET;
>>                 rtp_addr.sin_port = htons (rtp_port);
>>                 rtp_addr.sin_addr.s_addr = INADDR_ANY;
>>
>>                 res = bind(rtp_sockfd, (struct sockaddr*)&rtp_addr,
>> sizeof(rtp_addr));
>>                 if (res == 0) {
>>                         printf("Succesfully bound to local RTP port
>> %d.\n", rtp_port);
>>                 } else {
>>                         printf("Unable to bind to local RTP port
>> %d.\n", rtp_port);
>>                         rtp_sockfd = -1;
>>                 }
>>         }
>>
>>          /* Creating an UDP sink for RTP */
>>         udp_rtp_sink = gst_element_factory_make("udpsink", "udpsink0");
>>         if (!udp_rtp_sink) {
>>                 g_printerr ("udp_rtp_sink element could not be created."
>>                             " Exiting.\n");
>>                 return NULL;
>>         }
>>
>>        if (rtp_sockfd != -1)
>>                 g_object_set(G_OBJECT(udp_rtp_sink), "sockfd",
>> rtp_sockfd, "port",
>>                                                 remote_rtp_port,  NULL);
>>
>> -----------------------------------------------------------------------------------------------------------------
>>
>> Error:
>> Could not get/set settings from/on resource
>>
>>
>> Thanks and Regards,
>> Sunil
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list