Skip to content

Commit

Permalink
tcpclientsrc: Fix compilation on FreeBSD
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vivia authored and tp-m committed Mar 8, 2020
1 parent 40773e9 commit d1c9972
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gst/tcp/gsttcpclientsrc.c
Expand Up @@ -585,13 +585,24 @@ 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,
"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);
#endif
}
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions meson.build
Expand Up @@ -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())
Expand Down

0 comments on commit d1c9972

Please sign in to comment.