mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
tcpclientsrc, tcpserversrc: fix tcp stats gathering
Fix-up after commit e56b78417
. Unclear how that could
ever have worked. Code only built because basically
everything was disabled due to the missing config.h
include.
- Include config.h so that HAVE_* defines are available.
- Fix missing variable declarations that somehow disappeared
when moving the stats gathering code block into a separate
function in a new file.
- Fix structure variable modified to match name in new function.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8211>
This commit is contained in:
parent
e272e229e8
commit
b4bef7fd35
1 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* macOS and iOS have the .h files but the tcp_info struct is private API */
|
||||
#if defined(HAVE_NETINET_TCP_H) && defined(HAVE_NETINET_IN_H) && defined(HAVE_SYS_SOCKET_H)
|
||||
#include <netinet/tcp.h>
|
||||
|
@ -14,10 +18,14 @@ void
|
|||
gst_tcp_stats_from_socket (GstStructure * structure, GSocket * socket)
|
||||
{
|
||||
#ifdef HAVE_SOCKET_METRIC_HEADERS
|
||||
struct tcp_info info = { 0, };
|
||||
socklen_t info_len = sizeof (info);
|
||||
int fd = g_socket_get_fd (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,
|
||||
gst_structure_set (structure,
|
||||
"reordering", G_TYPE_UINT, info.__tcpi_reordering,
|
||||
"unacked", G_TYPE_UINT, info.__tcpi_unacked,
|
||||
"sacked", G_TYPE_UINT, info.__tcpi_sacked,
|
||||
|
@ -25,7 +33,7 @@ gst_tcp_stats_from_socket (GstStructure * structure, GSocket * socket)
|
|||
"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,
|
||||
gst_structure_set (structure,
|
||||
"reordering", G_TYPE_UINT, info.tcpi_reordering,
|
||||
"unacked", G_TYPE_UINT, info.tcpi_unacked,
|
||||
"sacked", G_TYPE_UINT, info.tcpi_sacked,
|
||||
|
|
Loading…
Reference in a new issue