From fcfa13b0fec5dd64214b2451592afcbc745f7a56 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Fri, 22 Oct 2021 16:43:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9C=80=E6=96=B0zltoolkit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- 3rdpart/media-server | 2 +- src/Http/WebSocketClient.h | 15 ++++++++------- src/Record/MP4Recorder.cpp | 7 +------ 4 files changed, 11 insertions(+), 15 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 7923e964..2fe11e25 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 7923e9646f1779d8ce8f256c7f9c0a5bee69e7d7 +Subproject commit 2fe11e250eeec2e79ee210b89a7f1a78f6d40630 diff --git a/3rdpart/media-server b/3rdpart/media-server index 0caa03c0..6ac21f84 160000 --- a/3rdpart/media-server +++ b/3rdpart/media-server @@ -1 +1 @@ -Subproject commit 0caa03c07e2ed40ec996479d594f1a75e9bd3f03 +Subproject commit 6ac21f845567afe7256709764373cbc3dc8d57ad diff --git a/src/Http/WebSocketClient.h b/src/Http/WebSocketClient.h index e4abd53c..5031ff0f 100644 --- a/src/Http/WebSocketClient.h +++ b/src/Http/WebSocketClient.h @@ -368,18 +368,19 @@ public: * 目的是替换TcpClient的连接服务器行为,使之先完成WebSocket握手 * @param host websocket服务器ip或域名 * @param iPort websocket服务器端口 - * @param fTimeOutSec 超时时间 + * @param timeout_sec 超时时间 + * @param local_port 本地监听端口,此处不起作用 */ - void startConnect(const string &host, uint16_t iPort, float fTimeOutSec = 3) override { + void startConnect(const string &host, uint16_t port, float timeout_sec = 3, uint16_t local_port = 0) override { string ws_url; - if(useWSS){ + if (useWSS) { //加密的ws - ws_url = StrPrinter << "wss://" + host << ":" << iPort << "/" ; - }else{ + ws_url = StrPrinter << "wss://" + host << ":" << port << "/"; + } else { //明文ws - ws_url = StrPrinter << "ws://" + host << ":" << iPort << "/" ; + ws_url = StrPrinter << "ws://" + host << ":" << port << "/"; } - _wsClient->startWsClient(ws_url,fTimeOutSec); + _wsClient->startWsClient(ws_url, timeout_sec); } void startWebSocket(const string &ws_url,float fTimeOutSec = 3){ diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 8838abc6..5d9c1570 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -72,13 +72,8 @@ void MP4Recorder::asyncClose() { info.time_len = (float) (::time(NULL) - info.start_time); //关闭mp4非常耗时,所以要放在后台线程执行 muxer->closeMP4(); - //获取文件大小 - auto fp = fopen(full_path_tmp.data(), "rb"); - assert(fp); - info.file_size = File::fileSize(fp); - fclose(fp); - + info.file_size = File::fileSize(full_path_tmp.data()); if (info.file_size < 1024) { //录像文件太小,删除之 File::delete_file(full_path_tmp.data());