tcpclientsrc: Fix compilation on FreeBSD

The members of the tcp_info struct are prefixed with a double
underscore, as reported in
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/584#note_423487
This commit is contained in:
Vivia Nikolaidou 2020-03-03 15:19:21 +02:00 committed by Tim-Philipp Müller
parent 40773e9c91
commit d1c9972e94
2 changed files with 19 additions and 0 deletions

View file

@ -585,6 +585,16 @@ gst_tcp_client_src_get_stats (GstTCPClientSrc * src)
fd = g_socket_get_fd (src->socket);
if (getsockopt (fd, IPPROTO_TCP, TCP_INFO, &info, &info_len) == 0) {
/* this is system-specific */
#ifdef HAVE_BSD_TCP_INFO
gst_structure_set (s,
"reordering", G_TYPE_UINT, info.__tcpi_reordering,
"unacked", G_TYPE_UINT, info.__tcpi_unacked,
"sacked", G_TYPE_UINT, info.__tcpi_sacked,
"lost", G_TYPE_UINT, info.__tcpi_lost,
"retrans", G_TYPE_UINT, info.__tcpi_retrans,
"fackets", G_TYPE_UINT, info.__tcpi_fackets, NULL);
#elif defined(HAVE_LINUX_TCP_INFO)
gst_structure_set (s,
"reordering", G_TYPE_UINT, info.tcpi_reordering,
"unacked", G_TYPE_UINT, info.tcpi_unacked,
@ -592,6 +602,7 @@ gst_tcp_client_src_get_stats (GstTCPClientSrc * src)
"lost", G_TYPE_UINT, info.tcpi_lost,
"retrans", G_TYPE_UINT, info.tcpi_retrans,
"fackets", G_TYPE_UINT, info.tcpi_fackets, NULL);
#endif
}
}
#endif

View file

@ -375,6 +375,14 @@ else
endif
endif
if cc.has_member('struct tcp_info', '__tcpi_reordering', prefix: '#include <netinet/tcp.h>')
core_conf.set('HAVE_BSD_TCP_INFO', true)
endif
if cc.has_member('struct tcp_info', 'tcpi_reordering', prefix: '#include <netinet/tcp.h>')
core_conf.set('HAVE_LINUX_TCP_INFO', true)
endif
gir = find_program('g-ir-scanner', required : get_option('introspection'))
gnome = import('gnome')
build_gir = gir.found() and (not meson.is_cross_build() or get_option('introspection').enabled())