Skip to content

Commit

Permalink
API: Use libuuid to generate uuid. v5.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 6, 2021
1 parent 06f10b1 commit 983d521
Show file tree
Hide file tree
Showing 9 changed files with 1,461 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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。

Expand Down
25 changes: 13 additions & 12 deletions trunk/3rdparty/st-srs/md_darwin.S
Original file line number Diff line number Diff line change
Expand Up @@ -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 R12–R15, 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:
Expand All @@ -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:
Expand All @@ -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) */

/****************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion trunk/src/app/srs_app_latest_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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();
}
Expand Down
Loading

0 comments on commit 983d521

Please sign in to comment.