From 9d2498a694e24175ad6a947894cbb393f6eaf487 Mon Sep 17 00:00:00 2001
From: ziyue <1213642868@qq.com>
Date: Mon, 29 Mar 2021 12:28:47 +0800
Subject: [PATCH] =?UTF-8?q?candidate=20foundation=E6=94=B9=E4=B8=BAstring?=
=?UTF-8?q?=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
conf/config.ini | 16 ++++++++--------
server/main.cpp | 2 ++
webrtc/Sdp.cpp | 8 +++++---
webrtc/Sdp.h | 2 +-
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/conf/config.ini b/conf/config.ini
index 59a7f06b..a2d66b04 100644
--- a/conf/config.ini
+++ b/conf/config.ini
@@ -140,14 +140,14 @@ maxReqSize=4096
#404网页内容,用户可以自定义404网页
notFound=
404 Not Found您访问的资源不存在!
ZLMediaKit-4.0
#http服务器监听端口
-port=80
+port=0
#http文件服务器根目录
#可以为相对(相对于本可执行程序目录)或绝对路径
rootPath=./www
#http文件服务器读文件缓存大小,单位BYTE,调整该参数可以优化文件io性能
sendBufSize=65536
#https服务器监听端口
-sslport=443
+sslport=20443
#是否显示文件夹菜单,开启后可以浏览文件夹
dirMenu=1
@@ -187,9 +187,9 @@ keepAliveSecond=15
#在接收rtmp推流时,是否重新生成时间戳(很多推流器的时间戳着实很烂)
modifyStamp=0
#rtmp服务器监听端口
-port=1935
+port=8935
#rtmps服务器监听地址
-sslport=19350
+sslport=0
[rtp]
#音频mtu大小,该参数限制rtp最大字节数,推荐不要超过1400
@@ -202,7 +202,7 @@ videoMtuSize=1400
#导出调试数据(包括rtp/ps/h264)至该目录,置空则关闭数据导出
dumpDir=
#udp和tcp代理服务器,支持rtp(必须是ts或ps类型)代理
-port=10000
+port=0
#rtp超时时间,单位秒
timeoutSec=15
@@ -221,13 +221,13 @@ handshakeSecond=15
#或者tcp发送缓存超过这个时间,则会断开连接,单位秒
keepAliveSecond=15
#rtsp服务器监听地址
-port=554
+port=8554
#rtsps服务器监听地址
-sslport=322
+sslport=0
[shell]
#调试telnet服务器接受最大bufffer大小
maxReqSize=1024
#调试telnet服务器监听端口
-port=9000
+port=0
diff --git a/server/main.cpp b/server/main.cpp
index 75264ff3..e70ed504 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -209,6 +209,7 @@ static void inline listen_shell_input(){
//全局变量,在WebApi中用于保存配置文件用
string g_ini_file;
+extern void test_sdp();
int start_main(int argc,char *argv[]) {
{
CMD_main cmd_main;
@@ -266,6 +267,7 @@ int start_main(int argc,char *argv[]) {
});
}
+ test_sdp();
uint16_t shellPort = mINI::Instance()[Shell::kPort];
uint16_t rtspPort = mINI::Instance()[Rtsp::kPort];
uint16_t rtspsPort = mINI::Instance()[Rtsp::kSSLPort];
diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp
index 4db1f14c..04766eda 100644
--- a/webrtc/Sdp.cpp
+++ b/webrtc/Sdp.cpp
@@ -689,14 +689,16 @@ string SdpAttrSctpMap::toString() const {
}
void SdpAttrCandidate::parse(const string &str) {
+ char foundation_buf[32] = {0};
char transport_buf[16] = {0};
char address_buf[32] = {0};
char type_buf[16] = {0};
- if (7 != sscanf(str.data(), "%" SCNu32 " %" SCNu32 " %15[^ ] %" SCNu32 " %31[^ ] %" SCNu16 " typ %15[^ ]",
- &foundation, &component, transport_buf, &priority, address_buf, &port, type_buf)) {
+ if (7 != sscanf(str.data(), "%31[^ ] %" SCNu32 " %15[^ ] %" SCNu32 " %31[^ ] %" SCNu16 " typ %15[^ ]",
+ foundation_buf, &component, transport_buf, &priority, address_buf, &port, type_buf)) {
SDP_THROW();
}
+ foundation = foundation_buf;
transport = transport_buf;
address = address_buf;
type = type_buf;
@@ -720,7 +722,7 @@ void SdpAttrCandidate::parse(const string &str) {
string SdpAttrCandidate::toString() const {
if (value.empty()) {
- value = to_string(foundation) + " " + to_string(component) + " " + transport + " " + to_string(priority) +
+ value = foundation + " " + to_string(component) + " " + transport + " " + to_string(priority) +
" " + address + " " + to_string(port) + " typ " + type;
for (auto &pr : arr) {
value += ' ';
diff --git a/webrtc/Sdp.h b/webrtc/Sdp.h
index ec38fb05..fd56ec26 100644
--- a/webrtc/Sdp.h
+++ b/webrtc/Sdp.h
@@ -407,7 +407,7 @@ public:
//15.1. "candidate" Attribute
//a=candidate:4 1 udp 2 192.168.1.7 58107 typ host
//a=candidate: typ
- uint32_t foundation;
+ string foundation;
uint32_t component;
string transport {"udp"};
uint32_t priority;