mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
For #307, disable GSO < linux 4.18.0
This commit is contained in:
parent
feaf98eb69
commit
2cd580f500
1 changed files with 22 additions and 5 deletions
|
@ -33,6 +33,10 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef __linux__
|
||||||
|
#include <linux/version.h>
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -4805,12 +4809,25 @@ bool SrsConfig::get_rtc_server_gso()
|
||||||
|
|
||||||
bool v = SRS_CONF_PERFER_FALSE(conf->arg0());
|
bool v = SRS_CONF_PERFER_FALSE(conf->arg0());
|
||||||
|
|
||||||
#ifdef SRS_AUTO_OSX
|
bool gso_disabled = false;
|
||||||
if (v) {
|
#if !defined(__linux__)
|
||||||
srs_warn("GSO is for Linux only");
|
gso_disabled = true;
|
||||||
}
|
srs_warn("GSO is for Linux 4.18+ only");
|
||||||
v = false;
|
#else
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0)
|
||||||
|
utsname un = {0};
|
||||||
|
int r0 = uname(&un);
|
||||||
|
if (r0 || strcmp(un.release, "4.18.0") < 0) {
|
||||||
|
gso_disabled = true;
|
||||||
|
}
|
||||||
|
srs_warn("GSO is for Linux 4.18+ only, r0=%d, %s", r0, un.release);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (v && gso_disabled) {
|
||||||
|
v = false;
|
||||||
|
}
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue