mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
parent
20fb5f3e8e
commit
db7ddfd510
16 changed files with 1075 additions and 52 deletions
|
@ -26,6 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#include <srs_kernel_error.hpp>
|
||||
#include <srs_kernel_log.hpp>
|
||||
|
||||
#ifndef SRS_OSX
|
||||
#include <sys/epoll.h>
|
||||
bool srs_st_epoll_is_supported(void)
|
||||
{
|
||||
|
@ -38,11 +39,13 @@ bool srs_st_epoll_is_supported(void)
|
|||
|
||||
return (errno != ENOSYS);
|
||||
}
|
||||
#endif
|
||||
|
||||
int srs_init_st()
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
// check epoll, some old linux donot support epoll.
|
||||
// @see https://github.com/winlinvip/simple-rtmp-server/issues/162
|
||||
if (!srs_st_epoll_is_supported()) {
|
||||
|
@ -58,6 +61,7 @@ int srs_init_st()
|
|||
return ret;
|
||||
}
|
||||
srs_verbose("st_set_eventsys use linux epoll success");
|
||||
#endif
|
||||
|
||||
if(st_init() != 0){
|
||||
ret = ERROR_ST_INITIALIZE;
|
||||
|
|
|
@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
// current release version
|
||||
#define VERSION_MAJOR 2
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_REVISION 136
|
||||
#define VERSION_REVISION 137
|
||||
|
||||
// server info.
|
||||
#define RTMP_SIG_SRS_KEY "SRS"
|
||||
|
|
|
@ -437,7 +437,9 @@ u_int32_t srs_crc32(const void* buf, int size)
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef UINT_MAX
|
||||
#define UINT_MAX 0xffffffff
|
||||
#endif
|
||||
|
||||
#ifndef AV_RB32
|
||||
# define AV_RB32(x) \
|
||||
|
|
|
@ -177,6 +177,23 @@ void show_macro_features()
|
|||
|
||||
void check_macro_features()
|
||||
{
|
||||
// important preset.
|
||||
#ifdef SRS_OSX
|
||||
srs_trace("SRS for OSX");
|
||||
#endif
|
||||
#ifdef SRS_PI
|
||||
srs_trace("SRS for pi");
|
||||
#endif
|
||||
#ifdef SRS_CUBIE
|
||||
srs_trace("SRS for cubieboard");
|
||||
#endif
|
||||
#ifdef SRS_ARM_UBUNTU12
|
||||
srs_trace("SRS for arm(build on ubuntu)");
|
||||
#endif
|
||||
#ifdef SRS_MIPS_UBUNTU12
|
||||
srs_trace("SRS for mips(build on ubuntu)");
|
||||
#endif
|
||||
|
||||
// for special features.
|
||||
#ifndef SRS_PERF_MERGED_READ
|
||||
srs_warn("MR(merged-read) is disabled, hurts read performance. @see %s", RTMP_SIG_SRS_ISSUES(241));
|
||||
|
@ -252,8 +269,8 @@ int main(int argc, char** argv)
|
|||
srs_trace("conf: %s, limit: %d", _srs_config->config().c_str(), _srs_config->get_max_connections());
|
||||
|
||||
// features
|
||||
show_macro_features();
|
||||
check_macro_features();
|
||||
show_macro_features();
|
||||
|
||||
/**
|
||||
* we do nothing in the constructor of server,
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace _srs_internal
|
|||
int __openssl_HMACsha256(HMAC_CTX* ctx, const void* data, int data_size, void* digest, unsigned int* digest_size)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
#ifndef SRS_OSX
|
||||
if (HMAC_Update(ctx, (unsigned char *) data, data_size) < 0) {
|
||||
ret = ERROR_OpenSslSha256Update;
|
||||
return ret;
|
||||
|
@ -83,6 +83,10 @@ namespace _srs_internal
|
|||
ret = ERROR_OpenSslSha256Final;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
HMAC_Update(ctx, (unsigned char *) data, data_size);
|
||||
HMAC_Final(ctx, (unsigned char *) digest, digest_size);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -117,10 +121,14 @@ namespace _srs_internal
|
|||
// for instance, in python, hashlib.sha256(data).digest().
|
||||
HMAC_CTX_init(&ctx);
|
||||
|
||||
#ifndef SRS_OSX
|
||||
if (HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL) < 0) {
|
||||
ret = ERROR_OpenSslSha256Init;
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
HMAC_Init_ex(&ctx, __key, key_size, EVP_sha256(), NULL);
|
||||
#endif
|
||||
|
||||
ret = __openssl_HMACsha256(&ctx, data, data_size, __digest, &digest_size);
|
||||
HMAC_CTX_cleanup(&ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue