1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00
This commit is contained in:
winlin 2021-08-06 22:00:35 +08:00
commit 7fd7036036
8 changed files with 1460 additions and 17 deletions

View file

@ -5,7 +5,7 @@
[![](https://circleci.com/gh/ossrs/srs/tree/develop.svg?style=svg&circle-token=1ef1d5b5b0cde6c8c282ed856a18199f9e8f85a9)](https://circleci.com/gh/ossrs/srs/tree/develop)
[![](https://codecov.io/gh/ossrs/srs/branch/develop/graph/badge.svg)](https://codecov.io/gh/ossrs/srs/branch/develop)
[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/wechat-badge.png)](../../wikis/Contact#wechat)
[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/bbs.png)](http://bbs.ossrs.net)
[![](https://gitee.com/winlinvip/srs-wiki/raw/master/images/bbs2.png)](http://bbs.ossrs.net)
SRS/4.0 [Leo](https://github.com/ossrs/srs/wiki/v4_CN_Product#release40) 是一个简单高效的实时视频服务器支持RTMP/WebRTC/HLS/HTTP-FLV/SRT。

View file

@ -11,17 +11,17 @@
*/
#define JB_RBX 0
#define JB_RBP 1
#define JB_R12 2 /* Backup IP, https://www.cnblogs.com/Five100Miles/p/8458561.html */
#define JB_R13 3 /* Backup SP, https://www.cnblogs.com/Five100Miles/p/8458561.html */
#define JB_R14 4 /* Backup LR, https://www.cnblogs.com/Five100Miles/p/8458561.html */
#define JB_R15 5 /* Backup PC, https://www.cnblogs.com/Five100Miles/p/8458561.html */
#define JB_R12 2 /* The first six integer or pointer arguments are passed in registers RDI, RSI, RDX, RCX, R8, R9. */
#define JB_R13 3 /* If the callee wishes to use registers RBX, RSP, RBP, and R12R15, it must restore their original values before returning control to the caller. */
#define JB_R14 4 /* @see https://en.wikipedia.org/wiki/X86_calling_conventions */
#define JB_R15 5 /* @see https://www.cnblogs.com/Five100Miles/p/8458561.html */
#define JB_RSP 6
#define JB_PC 7
.file "md_darwin.S"
.text
/* _st_md_cxt_save(__jmp_buf env) */ /* The env is rdi, http://blog.chinaunix.net/uid-20157960-id-1974354.html */
/* _st_md_cxt_save(__jmp_buf env) */ /* The env is rdi, https://en.wikipedia.org/wiki/X86_calling_conventions */
.globl __st_md_cxt_save
.align 16
__st_md_cxt_save:
@ -35,18 +35,18 @@
movq %r14, (JB_R14*8)(%rdi) /* Save r14 to env[4], *(int64_t*)(rdi+4)=r14 */
movq %r15, (JB_R15*8)(%rdi) /* Save r15 to env[5], *(int64_t*)(rdi+5)=r15 */
/* Save SP */
leaq 8(%rsp), %rdx /* Save *(int64_t*)(rsp+8) to rdx, https://my.oschina.net/guonaihong/blog/508907 */
movq %rdx, (JB_RSP*8)(%rdi) /* Save rdx(rsp) to env[6], *(int64_t*)(rdi+6)=rdx */
leaq 8(%rsp), %r8 /* Save *(int64_t*)(rsp+8) to r8, https://github.com/ossrs/state-threads/issues/11#issuecomment-888709759 */
movq %r8, (JB_RSP*8)(%rdi) /* Save r8(rsp) to env[6], *(int64_t*)(rdi+6)=r8 */
/* Save PC we are returning to */
movq (%rsp), %rax /* Save PC(parent function address) %(rsp) to rax */
movq %rax, (JB_PC*8)(%rdi) /* Save rax(PC) to env[7], *(int64_t*)(rdi+7)=rax */
movq (%rsp), %r9 /* Save PC(parent function address) %(rsp) to r9 */
movq %r9, (JB_PC*8)(%rdi) /* Save r9(PC) to env[7], *(int64_t*)(rdi+7)=r9 */
xorq %rax, %rax /* Reset rax to 0 */
ret
/****************************************************************/
/* _st_md_cxt_restore(__jmp_buf env, int val) */ /* The env is rdi, val is esi/rsi, http://blog.chinaunix.net/uid-20157960-id-1974354.html */
/* _st_md_cxt_restore(__jmp_buf env, int val) */ /* The env is rdi, val is esi/rsi, https://en.wikipedia.org/wiki/X86_calling_conventions */
.globl __st_md_cxt_restore
.align 16
__st_md_cxt_restore:
@ -64,10 +64,11 @@
mov $01, %eax /* val=1; */
cmove %eax, %esi /* } */
mov %esi, %eax /* return val; */
movq (JB_PC*8)(%rdi), %rdx /* Load rdx(PC) from env[7] */
/* Restore PC and RSP */
movq (JB_PC*8)(%rdi), %r8 /* Load r8(PC) from env[7] */
movq (JB_RSP*8)(%rdi), %rsp /* Load rsp from env[6] */
/* Jump to saved PC */
jmpq *%rdx /* Jump to rdx(PC) */
jmpq *%r8 /* Jump to r8(PC) */
/****************************************************************/

2
trunk/configure vendored
View file

@ -270,7 +270,7 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_sourc
"srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static"
"srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
"srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
"srs_app_caster_flv" "srs_app_latest_version" "srs_app_process" "srs_app_ng_exec"
"srs_app_caster_flv" "srs_app_latest_version" "srs_app_uuid" "srs_app_process" "srs_app_ng_exec"
"srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
"srs_app_coworkers" "srs_app_hybrid" "srs_app_threads")
if [[ $SRS_RTC == YES ]]; then

View file

@ -16,6 +16,7 @@
#include <srs_app_http_conn.hpp>
#include <srs_app_http_client.hpp>
#include <srs_app_utility.hpp>
#include <srs_app_uuid.hpp>
#include <unistd.h>
#include <sstream>
@ -37,7 +38,16 @@ srs_error_t SrsLatestVersion::start()
return srs_success;
}
server_id_ = srs_random_str(16);
if (true) {
uuid_t uuid;
uuid_generate_time(uuid);
char buf[32];
for (int i = 0; i < 16; i++) {
snprintf(buf + i * 2, sizeof(buf), "%02x", uuid[i]);
}
server_id_ = string(buf, sizeof(buf));
}
return trd_->start();
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,112 @@
//
// libuuid BSD License @see https://sourceforge.net/projects/libuuid/
//
// SPDX-License-Identifier: BSD-3-Clause
//
#include <srs_core.hpp>
/*
* Public include file for the UUID library
*
* Copyright (C) 1996, 1997, 1998 Theodore Ts'o.
*
* %Begin-Header%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, and the entire permission notice in its entirety,
* including the disclaimer of warranties.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
* WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
* %End-Header%
*/
#ifndef _UUID_UUID_H
#define _UUID_UUID_H
#include <sys/types.h>
#ifndef _WIN32
#include <sys/time.h>
#endif
#include <time.h>
typedef unsigned char uuid_t[16];
/* UUID Variant definitions */
#define UUID_VARIANT_NCS 0
#define UUID_VARIANT_DCE 1
#define UUID_VARIANT_MICROSOFT 2
#define UUID_VARIANT_OTHER 3
/* UUID Type definitions */
#define UUID_TYPE_DCE_TIME 1
#define UUID_TYPE_DCE_RANDOM 4
/* Allow UUID constants to be defined */
#ifdef __GNUC__
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#else
#define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \
static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* clear.c */
void uuid_clear(uuid_t uu);
/* compare.c */
int uuid_compare(const uuid_t uu1, const uuid_t uu2);
/* copy.c */
void uuid_copy(uuid_t dst, const uuid_t src);
/* gen_uuid.c */
void uuid_generate(uuid_t out);
void uuid_generate_random(uuid_t out);
void uuid_generate_time(uuid_t out);
int uuid_generate_time_safe(uuid_t out);
/* isnull.c */
int uuid_is_null(const uuid_t uu);
/* parse.c */
int uuid_parse(const char *in, uuid_t uu);
/* unparse.c */
void uuid_unparse(const uuid_t uu, char *out);
void uuid_unparse_lower(const uuid_t uu, char *out);
void uuid_unparse_upper(const uuid_t uu, char *out);
/* uuid_time.c */
time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
int uuid_type(const uuid_t uu);
int uuid_variant(const uuid_t uu);
#ifdef __cplusplus
}
#endif
#endif /* _UUID_UUID_H */

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 3
#define VERSION_MINOR 0
#define SRS_VERSION3_REVISION 164
#define SRS_VERSION3_REVISION 165
#endif

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 146
#define VERSION_REVISION 147
#endif