mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Add support for compiling under MinGW + fix Windows compiling in general
This commit is contained in:
parent
e3a45c193c
commit
a5cf494890
56 changed files with 243 additions and 76 deletions
|
|
@ -1 +1,13 @@
|
|||
// Intentionally left blank
|
||||
/*
|
||||
* Stagefright's win32 include path shadows the toolchain <pthread.h>.
|
||||
* On MinGW we need the real pthread declarations for libstdc++ gthr.
|
||||
*/
|
||||
|
||||
#ifndef stagefright_win32_pthread_h
|
||||
#define stagefright_win32_pthread_h
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# include_next <pthread.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ public:
|
|||
}
|
||||
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.if_info.type & NR_INTERFACE_TYPE_VPN) != 0 ? 1 : 0;
|
||||
estimated_speed_ = local_addr.if_info.estimated_speed;
|
||||
type_preference_ = GetNetworkTypePreference(local_addr.if_info.type);
|
||||
ip_version_ = local_addr.addr.ip_version;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1996,8 +1996,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.if_info.type = type;
|
||||
local_addr.if_info.estimated_speed = estimated_speed;
|
||||
|
||||
int r = nr_str_port_to_transport_addr(str_addr.c_str(), 0,
|
||||
IPPROTO_UDP, &(local_addr.addr));
|
||||
|
|
|
|||
|
|
@ -40,13 +40,13 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from)
|
||||
{
|
||||
nr_transport_addr_copy(&(to->addr), &(from->addr));
|
||||
to->interface = from->interface;
|
||||
to->if_info = from->if_info;
|
||||
return(0);
|
||||
}
|
||||
|
||||
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->if_info.type;
|
||||
const char *vpn = (addr_type & NR_INTERFACE_TYPE_VPN) ? "VPN on " : "";
|
||||
|
||||
const char *type = (addr_type & NR_INTERFACE_TYPE_WIRED) ? "wired" :
|
||||
|
|
@ -55,7 +55,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",
|
||||
vpn, type, addr->interface.estimated_speed);
|
||||
vpn, type, addr->if_info.estimated_speed);
|
||||
buf[len - 1] = '\0';
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef struct nr_interface_ {
|
|||
|
||||
typedef struct nr_local_addr_ {
|
||||
nr_transport_addr addr;
|
||||
nr_interface interface;
|
||||
nr_interface if_info;
|
||||
} nr_local_addr;
|
||||
|
||||
int nr_local_addr_copy(nr_local_addr *to, nr_local_addr *from);
|
||||
|
|
|
|||
|
|
@ -220,18 +220,18 @@ stun_get_win32_addrs(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].if_info.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].if_info.type = NR_INTERFACE_TYPE_WIFI;
|
||||
} else {
|
||||
addrs[n].interface.type = NR_INTERFACE_TYPE_UNKNOWN;
|
||||
addrs[n].if_info.type = NR_INTERFACE_TYPE_UNKNOWN;
|
||||
}
|
||||
#if (_WIN32_WINNT >= 0x0600)
|
||||
/* Note: only >= Vista provide link speed information */
|
||||
addrs[n].interface.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000;
|
||||
addrs[n].if_info.estimated_speed = tmpAddress->TransmitLinkSpeed / 1000;
|
||||
#else
|
||||
addrs[n].interface.estimated_speed = 0;
|
||||
addrs[n].if_info.estimated_speed = 0;
|
||||
#endif
|
||||
if (++n >= maxaddrs)
|
||||
goto done;
|
||||
|
|
@ -300,11 +300,11 @@ stun_getifaddrs(nr_local_addr addrs[], int maxaddrs, int *count)
|
|||
{
|
||||
/* For wireless network, we won't get ethtool, it's a wired
|
||||
* connection */
|
||||
addrs[*count].interface.type = NR_INTERFACE_TYPE_WIRED;
|
||||
addrs[*count].if_info.type = NR_INTERFACE_TYPE_WIRED;
|
||||
#ifdef DONT_HAVE_ETHTOOL_SPEED_HI
|
||||
addrs[*count].interface.estimated_speed = ecmd.speed;
|
||||
addrs[*count].if_info.estimated_speed = ecmd.speed;
|
||||
#else
|
||||
addrs[*count].interface.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000;
|
||||
addrs[*count].if_info.estimated_speed = ((ecmd.speed_hi << 16) | ecmd.speed) * 1000;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -312,20 +312,20 @@ stun_getifaddrs(nr_local_addr addrs[], int maxaddrs, int *count)
|
|||
e = ioctl(s, SIOCGIWRATE, &wrq);
|
||||
if (e == 0)
|
||||
{
|
||||
addrs[*count].interface.type = NR_INTERFACE_TYPE_WIFI;
|
||||
addrs[*count].interface.estimated_speed = wrq.u.bitrate.value / 1000;
|
||||
addrs[*count].if_info.type = NR_INTERFACE_TYPE_WIFI;
|
||||
addrs[*count].if_info.estimated_speed = wrq.u.bitrate.value / 1000;
|
||||
}
|
||||
|
||||
close(s);
|
||||
|
||||
if (if_addr->ifa_flags & IFF_POINTOPOINT)
|
||||
{
|
||||
addrs[*count].interface.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN;
|
||||
addrs[*count].if_info.type = NR_INTERFACE_TYPE_UNKNOWN | NR_INTERFACE_TYPE_VPN;
|
||||
/* TODO (Bug 896913): find backend network type of this VPN */
|
||||
}
|
||||
#else
|
||||
addrs[*count].interface.type = NR_INTERFACE_TYPE_UNKNOWN;
|
||||
addrs[*count].interface.estimated_speed = 0;
|
||||
addrs[*count].if_info.type = NR_INTERFACE_TYPE_UNKNOWN;
|
||||
addrs[*count].if_info.estimated_speed = 0;
|
||||
#endif
|
||||
strlcpy(addrs[*count].addr.ifname, if_addr->ifa_name, sizeof(addrs[*count].addr.ifname));
|
||||
++(*count);
|
||||
|
|
|
|||
|
|
@ -73,11 +73,17 @@ void SetCurrentThreadName(const char* name) {
|
|||
DWORD dwFlags;
|
||||
} threadname_info = {0x1000, name, static_cast<DWORD>(-1), 0};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
__try {
|
||||
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
|
||||
reinterpret_cast<ULONG_PTR*>(&threadname_info));
|
||||
} __except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
}
|
||||
#else
|
||||
// MinGW does not support MSVC's __try/__except syntax.
|
||||
::RaiseException(0x406D1388, 0, sizeof(threadname_info) / sizeof(DWORD),
|
||||
reinterpret_cast<ULONG_PTR*>(&threadname_info));
|
||||
#endif
|
||||
#elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
|
||||
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name));
|
||||
#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS)
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ BOOL MyWinHttpGetProxyForUrl(pfnWinHttpGetProxyForUrl pWHGPFU,
|
|||
// error.
|
||||
BOOL success = FALSE;
|
||||
|
||||
#if (_HAS_EXCEPTIONS == 0)
|
||||
#if (_HAS_EXCEPTIONS == 0) && defined(_MSC_VER)
|
||||
__try {
|
||||
success = pWHGPFU(hWinHttp, url, options, info);
|
||||
} __except(EXCEPTION_EXECUTE_HANDLER) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ protected:
|
|||
int32_t capabilityIndex);
|
||||
|
||||
int32_t DisconnectGraph();
|
||||
HRESULT VideoCaptureDS::ConnectDVCamera();
|
||||
HRESULT ConnectDVCamera();
|
||||
|
||||
DeviceInfoDS _dsInfo;
|
||||
VideoCaptureCapability _activeCapability;
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
#include <tchar.h>
|
||||
|
|
@ -33,7 +35,6 @@
|
|||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "webrtc/typedefs.h" // For architecture defines
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue