我使用C ++ socket get sockfd是
serversoc = socket(AF_INET, SOCK_DGRAM, 0);
然后我使用serversoc。设置udpsrc是
g_object_set(m_pUdpsrc, "sockfd", my_io_service, NULL);
运行我的程序时,提示消息是
Source\gst-plugins-good\gst\udp\gstudpsrc.c(957): gst_udpsrc_start (): /GstPipeline:my_pipeline/GstUDPSrc:m_pUdpsrc:
getsockname failed -1: No error (0)
Error: Could not get/set settings from/on resource.
为什么?
答案 0 :(得分:0)
udpsrc
元素不提供sockfd
属性。
我假设您要使用socket
属性。
此选项采用GSocket而非简单套接字。
以下是一个应该有效的示例代码:
GSocket * socketUDP = g_socket_new(G_SOCKET_FAMILY_IPV4, G_SOCKET_TYPE_DATAGRAM, G_SOCKET_PROTOCOL_UDP, NULL);
g_object_set (G_OBJECT (m_pUdpsrc), "socket", socketUDP, NULL);