commit eae42a6c85427da64ea7caad9eef0966fc8d9f0e parent c3cc709b98612b32c44b1c73eb10c1f2ebae259d Author: Marco Simonelli <msimonelli@protonmail.com> Date: Fri, 10 Mar 2023 12:09:57 +0000 BB 41459: WebRTC fails to build under mingw (Part 5) - fixes required to build dom/media/webrtc Diffstat:
13 files changed, 35 insertions(+), 33 deletions(-)
diff --git a/dom/media/webrtc/libwebrtc_overrides/modules/desktop_capture/desktop_capture_types.h b/dom/media/webrtc/libwebrtc_overrides/modules/desktop_capture/desktop_capture_types.h @@ -7,11 +7,11 @@ #ifndef DOM_MEDIA_WEBRTC_LIBWEBRTCOVERRIDES_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_TYPES_H_ #define DOM_MEDIA_WEBRTC_LIBWEBRTCOVERRIDES_MODULES_DESKTOP_CAPTURE_DESKTOP_CAPTURE_TYPES_H_ -// pid_t -#if !defined(XP_WIN) || defined(__MINGW32__) +#if defined(XP_WIN) && \ + !defined(__MINGW32__) // Moving this into the global namespace +typedef int pid_t; // matching what used to be in +#elif defined(XP_WIN) // video_capture_defines.h # include <sys/types.h> -#else -typedef int pid_t; #endif #include "../../third_party/libwebrtc/modules/desktop_capture/desktop_capture_types.h" diff --git a/dom/media/webrtc/libwebrtcglue/VideoConduit.cpp b/dom/media/webrtc/libwebrtcglue/VideoConduit.cpp @@ -103,8 +103,8 @@ #endif // for ntohs -#ifdef _MSC_VER -# include "Winsock2.h" +#ifdef WIN32 +# include "winsock2.h" #else # include <netinet/in.h> #endif diff --git a/dom/media/webrtc/sdp/RsdparsaSdpAttributeList.cpp b/dom/media/webrtc/sdp/RsdparsaSdpAttributeList.cpp @@ -8,6 +8,7 @@ #include <limits> #include <ostream> +#include <string> #include "SdpAttribute.h" #include "mozilla/Assertions.h" diff --git a/dom/media/webrtc/transport/nrinterfaceprioritizer.cpp b/dom/media/webrtc/transport/nrinterfaceprioritizer.cpp @@ -43,9 +43,9 @@ class LocalAddress { } addr_ = buf; - is_vpn_ = (local_addr.interface.type & NR_INTERFACE_TYPE_VPN) != 0 ? 1 : 0; - estimated_speed_ = local_addr.interface.estimated_speed; - type_preference_ = GetNetworkTypePreference(local_addr.interface.type); + is_vpn_ = (local_addr.iface.type & NR_INTERFACE_TYPE_VPN) != 0 ? 1 : 0; + estimated_speed_ = local_addr.iface.estimated_speed; + type_preference_ = GetNetworkTypePreference(local_addr.iface.type); ip_version_ = local_addr.addr.ip_version; return true; } diff --git a/dom/media/webrtc/transport/sigslot.h b/dom/media/webrtc/transport/sigslot.h @@ -115,7 +115,8 @@ # define WIN32_LEAN_AND_MEAN # endif # include "rtc_base/win32.h" -#elif defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS) +#elif (defined(__GNUG__) || defined(SIGSLOT_USE_POSIX_THREADS)) && \ + !defined(__MINGW32__) # define _SIGSLOT_HAS_POSIX_THREADS # include <pthread.h> #else diff --git a/dom/media/webrtc/transport/test/ice_unittest.cpp b/dom/media/webrtc/transport/test/ice_unittest.cpp @@ -1960,8 +1960,8 @@ class WebRtcIcePrioritizerTest : public StunTest { std::string str_addr = "10.0.0." + num; std::string ifname = "eth" + num; nr_local_addr local_addr; - local_addr.interface.type = type; - local_addr.interface.estimated_speed = estimated_speed; + local_addr.iface.type = type; + local_addr.iface.estimated_speed = estimated_speed; int r = nr_str_port_to_transport_addr(str_addr.c_str(), 0, IPPROTO_UDP, &(local_addr.addr)); @@ -2899,8 +2899,8 @@ TEST_F(WebRtcIceConnectTest, // prepare a fake wifi interface nr_local_addr wifi_addr; - wifi_addr.interface.type = NR_INTERFACE_TYPE_WIFI; - wifi_addr.interface.estimated_speed = 1000; + wifi_addr.iface.type = NR_INTERFACE_TYPE_WIFI; + wifi_addr.iface.estimated_speed = 1000; int r = nr_str_port_to_transport_addr(FAKE_WIFI_ADDR, 0, IPPROTO_UDP, &(wifi_addr.addr)); diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/net/local_addr.c b/dom/media/webrtc/transport/third_party/nICEr/src/net/local_addr.c @@ -44,7 +44,7 @@ int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from) if (r=nr_transport_addr_copy(&(to->addr), &(from->addr))) { ABORT(r); } - to->interface = from->interface; + to->iface = from->iface; to->flags = from->flags; _status=0; @@ -54,7 +54,7 @@ int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from) int nr_local_addr_fmt_info_string(nr_local_addr *addr, char *buf, int len) { - int addr_type = addr->interface.type; + int addr_type = addr->iface.type; const char *vpn = (addr_type & NR_INTERFACE_TYPE_VPN) ? "VPN on " : ""; const char *type = (addr_type & NR_INTERFACE_TYPE_WIRED) ? "wired" : @@ -63,7 +63,7 @@ int nr_local_addr_fmt_info_string(nr_local_addr *addr, char *buf, int len) "unknown"; snprintf(buf, len, "%s%s, estimated speed: %d kbps %s", - vpn, type, addr->interface.estimated_speed, + vpn, type, addr->iface.estimated_speed, (addr->flags & NR_ADDR_FLAG_TEMPORARY ? "temporary" : "")); buf[len - 1] = '\0'; return (0); diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/net/local_addr.h b/dom/media/webrtc/transport/third_party/nICEr/src/net/local_addr.h @@ -51,7 +51,7 @@ typedef struct nr_interface_ { typedef struct nr_local_addr_ { nr_transport_addr addr; - nr_interface interface; + nr_interface iface; #define NR_ADDR_FLAG_TEMPORARY 0x1 int flags; } nr_local_addr; diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-netlink.c @@ -139,7 +139,7 @@ stun_convert_netlink(nr_local_addr *addr, struct ifaddrmsg *address_msg, struct int flags = get_siocgifflags(addr); if (flags & IFF_POINTOPOINT) { - addr->interface.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN; + addr->iface.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN; /* TODO (Bug 896913): find backend network type of this VPN */ } @@ -162,11 +162,11 @@ stun_convert_netlink(nr_local_addr *addr, struct ifaddrmsg *address_msg, struct { /* For wireless network, we won't get ethtool, it's a wired * connection */ - addr->interface.type = NR_INTERFACE_TYPE_WIRED; + addr->iface.type = NR_INTERFACE_TYPE_WIRED; #ifdef DONT_HAVE_ETHTOOL_SPEED_HI - addr->interface.estimated_speed = ecmd.speed; + addr->iface.estimated_speed = ecmd.speed; #else - addr->interface.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000; + addr->iface.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000; #endif } @@ -174,15 +174,15 @@ stun_convert_netlink(nr_local_addr *addr, struct ifaddrmsg *address_msg, struct e = ioctl(s, SIOCGIWRATE, &wrq); if (e == 0) { - addr->interface.type = NR_INTERFACE_TYPE_WIFI; - addr->interface.estimated_speed = wrq.u.bitrate.value / 1000; + addr->iface.type = NR_INTERFACE_TYPE_WIFI; + addr->iface.estimated_speed = wrq.u.bitrate.value / 1000; } close(s); #else - addr->interface.type = NR_INTERFACE_TYPE_UNKNOWN; - addr->interface.estimated_speed = 0; + addr->iface.type = NR_INTERFACE_TYPE_UNKNOWN; + addr->iface.estimated_speed = 0; #endif return 0; } diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c @@ -174,14 +174,14 @@ stun_getaddrs_filtered(nr_local_addr addrs[], int maxaddrs, int *count) strlcpy(addrs[n].addr.ifname, hex_hashed_ifname, sizeof(addrs[n].addr.ifname)); if (tmpAddress->IfType == IF_TYPE_ETHERNET_CSMACD) { - addrs[n].interface.type = NR_INTERFACE_TYPE_WIRED; + addrs[n].iface.type = NR_INTERFACE_TYPE_WIRED; } else if (tmpAddress->IfType == IF_TYPE_IEEE80211) { /* Note: this only works for >= Win Vista */ - addrs[n].interface.type = NR_INTERFACE_TYPE_WIFI; + addrs[n].iface.type = NR_INTERFACE_TYPE_WIFI; } else { - addrs[n].interface.type = NR_INTERFACE_TYPE_UNKNOWN; + addrs[n].iface.type = NR_INTERFACE_TYPE_UNKNOWN; } - addrs[n].interface.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000; + addrs[n].iface.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000; if (stun_win32_address_temp_v6(u)) { addrs[n].flags |= NR_ADDR_FLAG_TEMPORARY; } diff --git a/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c b/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c @@ -92,7 +92,7 @@ nr_stun_filter_addrs_for_ifname(nr_local_addr src[], const int src_begin, const if (src[i].addr.ip_version == NR_IPV6) { if (nr_transport_addr_is_teredo(&src[i].addr)) { - src[i].interface.type |= NR_INTERFACE_TYPE_TEREDO; + src[i].iface.type |= NR_INTERFACE_TYPE_TEREDO; /* Prefer teredo over mac-based address. Probably will never see * both. */ filter_mac_ipv6 = 1; diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c b/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c @@ -46,7 +46,7 @@ #include <string.h> #include <errno.h> -#ifndef _MSC_VER +#ifndef WIN32 #include <strings.h> #include <syslog.h> #endif diff --git a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c @@ -44,7 +44,7 @@ #include <assert.h> #include <string.h> -#ifndef _MSC_VER +#ifndef WIN32 #include <strings.h> #include <sys/param.h> #include <netinet/in.h>