Setting Source port of udp sink

Sunil sunil.p at globaledgesoft.com
Sun Nov 27 22:37:17 PST 2011


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



More information about the gstreamer-devel mailing list