1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

SRT: Upgrade libsrt from 1.4.1 to 1.5.1. v6.0.12 (#3362)

Co-authored-by: winlin <winlin@vip.126.com>
This commit is contained in:
john 2023-01-04 19:56:33 +08:00 committed by GitHub
parent 7a56208f2f
commit fe086dfc31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 38185 additions and 15108 deletions

View file

@ -1,63 +0,0 @@
#ifndef _WINPORTING_H_
#define _WINPORTING_H_
// NOTE: This file has been borrowed from LCM project
// http://lcm-proj.github.io/
#if !defined(__MINGW32__)
#define strtoll _strtoi64
#define strdup _strdup
#define mode_t int
#define snprintf _snprintf
//#define PATH_MAX MAX_PATH
#define fseeko _fseeki64
#define ftello _ftelli64
//#define socklen_t int
#define in_addr_t in_addr
#define SHUT_RDWR SD_BOTH
#define HUGE HUGE_VAL
#define O_NONBLOCK 0x4000
#define F_GETFL 3
#define F_SETFL 4
#endif
#include <direct.h>
#include <winsock2.h>
#ifdef __cplusplus
extern "C" {
#endif
// Microsoft implementation of these structures has the
// pointer and length in reversed positions.
typedef struct iovec
{
ULONG iov_len;
char *iov_base;
} iovec;
typedef struct msghdr
{
struct sockaddr *msg_name;
int msg_namelen;
struct iovec *msg_iov;
ULONG msg_iovlen;
int msg_controllen;
char *msg_control;
ULONG msg_flags;
} msghdr;
//typedef long int ssize_t;
//int inet_aton(const char *cp, struct in_addr *inp);
int fcntl (int fd, int flag1, ...);
size_t recvmsg ( SOCKET s, struct msghdr *msg, int flags );
size_t sendmsg ( SOCKET s, const struct msghdr *msg, int flags );
#ifdef __cplusplus
}
#endif
#endif // _WINPORTING_H_

View file

@ -1,5 +1,5 @@
#ifndef INC__WINDOWS_SYSLOG_DEFS_H
#define INC__WINDOWS_SYSLOG_DEFS_H
#ifndef INC_SRT_WINDOWS_SYSLOG_DEFS_H
#define INC_SRT_WINDOWS_SYSLOG_DEFS_H
#define LOG_EMERG 0
#define LOG_ALERT 1

View file

@ -1,5 +1,5 @@
#ifndef INC__WIN_WINTIME
#define INC__WIN_WINTIME
#ifndef INC_SRT_WIN_WINTIME
#define INC_SRT_WIN_WINTIME
#include <winsock2.h>
#include <windows.h>
@ -7,7 +7,6 @@
// where pthread.h, which defines _POSIX_THREAD_SAFE_FUNCTIONS,
// has to be included before time.h so that time.h defines
// localtime_r correctly
#include <pthread.h>
#include <time.h>
#ifdef __cplusplus
@ -53,4 +52,4 @@ SRTCOMPAT_WINTIME_STATIC_INLINE_DECL int gettimeofday(
}
#endif
#endif // INC__WIN_WINTIME
#endif // INC_SRT_WIN_WINTIME

View file

@ -27,39 +27,11 @@ void SRTCompat_timeradd(struct timeval *a, struct timeval *b, struct timeval *re
}
}
int SRTCompat_gettimeofday(struct timeval* tp, struct timezone* tz)
int SRTCompat_gettimeofday(struct timeval* tp, struct timezone*)
{
static LARGE_INTEGER tickFrequency, epochOffset;
// For our first call, use "ftime()", so that we get a time with a proper epoch.
// For subsequent calls, use "QueryPerformanceCount()", because it's more fine-grain.
static int isFirstCall = 1;
LARGE_INTEGER tickNow;
QueryPerformanceCounter(&tickNow);
if (isFirstCall)
{
struct timeb tb;
ftime(&tb);
tp->tv_sec = (long)tb.time;
tp->tv_usec = 1000*tb.millitm;
// Also get our counter frequency:
QueryPerformanceFrequency(&tickFrequency);
// And compute an offset to add to subsequent counter times, so we get a proper epoch:
epochOffset.QuadPart = tb.time*tickFrequency.QuadPart + (tb.millitm*tickFrequency.QuadPart)/1000 - tickNow.QuadPart;
isFirstCall = 0; // for next time
}
else
{
// Adjust our counter time so that we get a proper epoch:
tickNow.QuadPart += epochOffset.QuadPart;
tp->tv_sec = (long) (tickNow.QuadPart / tickFrequency.QuadPart);
tp->tv_usec = (long) (((tickNow.QuadPart % tickFrequency.QuadPart) * 1000000L) / tickFrequency.QuadPart);
}
struct timeb tb;
ftime(&tb);
tp->tv_sec = (long)tb.time;
tp->tv_usec = 1000*tb.millitm;
return 0;
}