Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
29c8c9bf
Commit
29c8c9bf
authored
Apr 13, 2021
by
xia-chu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
f939e0a8
753fe058
隐藏空白字符变更
内嵌
并排
正在显示
23 个修改的文件
包含
289 行增加
和
176 行删除
+289
-176
AUTHORS
+3
-2
conf/config.ini
+9
-1
server/CMakeLists.txt
+5
-1
server/main.cpp
+0
-148
src/Extension/CommonRtp.cpp
+1
-1
src/Rtsp/Rtsp.cpp
+4
-0
src/Rtsp/Rtsp.h
+4
-0
src/Rtsp/RtspMediaSourceImp.h
+9
-3
webrtc/DtlsTransport.cpp
+19
-1
webrtc/DtlsTransport.hpp
+19
-1
webrtc/IceServer.cpp
+19
-1
webrtc/IceServer.hpp
+19
-1
webrtc/Sdp.cpp
+9
-3
webrtc/Sdp.h
+9
-3
webrtc/SrtpSession.cpp
+20
-2
webrtc/SrtpSession.hpp
+19
-1
webrtc/StunPacket.cpp
+19
-1
webrtc/StunPacket.hpp
+19
-1
webrtc/Utils.hpp
+19
-1
webrtc/WebRtcTransport.cpp
+12
-2
webrtc/WebRtcTransport.h
+12
-2
webrtc/readme.md
+37
-0
www/webrtc/readme.txt
+3
-0
没有找到文件。
AUTHORS
查看文件 @
29c8c9bf
...
@@ -31,4 +31,5 @@ Luke <automan@easydarwin.org>
...
@@ -31,4 +31,5 @@ Luke <automan@easydarwin.org>
大裤衩 <3503207480@qq.com>
大裤衩 <3503207480@qq.com>
droid.chow <droid.chow@gmail.com>
droid.chow <droid.chow@gmail.com>
[陈晓林](https://github.com/musicwood)
[陈晓林](https://github.com/musicwood)
[老衲不出家](https://github.com/monktan89)
[老衲不出家](https://github.com/monktan89)
\ No newline at end of file
[big panda](<2381267071@qq.com>)
\ No newline at end of file
conf/config.ini
查看文件 @
29c8c9bf
...
@@ -206,13 +206,21 @@ port=10000
...
@@ -206,13 +206,21 @@ port=10000
#rtp超时时间,单位秒
#rtp超时时间,单位秒
timeoutSec
=
15
timeoutSec
=
15
[rtc]
#rtc播放推流、播放超时时间
timeoutSec
=
15
#本机对rtc客户端的可见ip,作为服务器时一般为公网ip,置空时,会自动获取网卡ip
externIP
=
[rtsp]
[rtsp]
#rtsp专有鉴权方式是采用base64还是md5方式
#rtsp专有鉴权方式是采用base64还是md5方式
authBasic
=
0
authBasic
=
0
#rtsp拉流代理是否是直接代理模式
#rtsp拉流
、推流
代理是否是直接代理模式
#直接代理后支持任意编码格式,但是会导致GOP缓存无法定位到I帧,可能会导致开播花屏
#直接代理后支持任意编码格式,但是会导致GOP缓存无法定位到I帧,可能会导致开播花屏
#并且如果是tcp方式拉流,如果rtp大于mtu会导致无法使用udp方式代理
#并且如果是tcp方式拉流,如果rtp大于mtu会导致无法使用udp方式代理
#假定您的拉流源地址不是264或265或AAC,那么你可以使用直接代理的方式来支持rtsp代理
#假定您的拉流源地址不是264或265或AAC,那么你可以使用直接代理的方式来支持rtsp代理
#如果你是rtsp推拉流,但是rtc播放,也建议关闭直接代理模式,
#因为直接代理时,rtp中可能没有sps pps,会导致rtc无法播放
#默认开启rtsp直接代理,rtmp由于没有这些问题,是强制开启直接代理的
#默认开启rtsp直接代理,rtmp由于没有这些问题,是强制开启直接代理的
directProxy
=
1
directProxy
=
1
#rtsp必须在此时间内完成握手,否则服务器会断开链接,单位秒
#rtsp必须在此时间内完成握手,否则服务器会断开链接,单位秒
...
...
server/CMakeLists.txt
查看文件 @
29c8c9bf
...
@@ -48,4 +48,8 @@ else()
...
@@ -48,4 +48,8 @@ else()
install
(
TARGETS MediaServer DESTINATION
${
INSTALL_PATH_EXECUTABLE
}
)
install
(
TARGETS MediaServer DESTINATION
${
INSTALL_PATH_EXECUTABLE
}
)
endif
()
endif
()
target_link_libraries
(
MediaServer jsoncpp
${
LINK_LIB_LIST
}
)
if
(
CMAKE_SYSTEM_NAME MATCHES
"Linux"
)
target_link_libraries
(
MediaServer -Wl,--start-group jsoncpp
${
LINK_LIB_LIST
}
-Wl,--end-group
)
else
()
target_link_libraries
(
MediaServer jsoncpp
${
LINK_LIB_LIST
}
)
endif
()
server/main.cpp
查看文件 @
29c8c9bf
...
@@ -210,153 +210,6 @@ static void inline listen_shell_input(){
...
@@ -210,153 +210,6 @@ static void inline listen_shell_input(){
//全局变量,在WebApi中用于保存配置文件用
//全局变量,在WebApi中用于保存配置文件用
string
g_ini_file
;
string
g_ini_file
;
void
test_sdp
(){
char
str1
[]
=
"v=0
\n
"
"o=- 380154348540553537 2 IN IP4 127.0.0.1
\n
"
"s=-
\n
"
"b=CT:1900
\n
"
"t=0 0
\n
"
"a=group:BUNDLE video
\n
"
"a=msid-semantic: WMS
\n
"
"m=video 9 RTP/SAVPF 96
\n
"
"c=IN IP4 0.0.0.0
\n
"
"a=rtcp:9 IN IP4 0.0.0.0
\n
"
"a=ice-ufrag:1ZFN
\n
"
"a=ice-pwd:70P3H0jPlGz1fiJl5XZfXMZH
\n
"
"a=ice-options:trickle
\n
"
"a=fingerprint:sha-256 3E:10:35:6B:9A:9E:B0:55:AC:2A:88:F5:74:C1:70:32:B5:8D:88:1D:37:B0:9C:69:A6:DD:07:10:73:27:1A:16
\n
"
"a=setup:active
\n
"
"a=mid:video
\n
"
"a=recvonly
\n
"
"a=rtcp-mux
\n
"
"a=rtpmap:96 H264/90000
\n
"
"a=fmtp:96 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f"
;
char
str2
[]
=
"v=0
\n
"
"o=- 2584450093346841581 2 IN IP4 127.0.0.1
\n
"
"s=-
\n
"
"t=0 0
\n
"
"a=group:BUNDLE audio video data
\n
"
"a=msid-semantic: WMS 616cfbb1-33a3-4d8c-8275-a199d6005549
\n
"
"m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
\n
"
"c=IN IP4 0.0.0.0
\n
"
"a=rtcp:9 IN IP4 0.0.0.0
\n
"
"a=ice-ufrag:sXJ3
\n
"
"a=ice-pwd:yEclOTrLg1gEubBFefOqtmyV
\n
"
"a=fingerprint:sha-256 22:14:B5:AF:66:12:C7:C7:8D:EF:4B:DE:40:25:ED:5D:8F:17:54:DD:88:33:C0:13:2E:FD:1A:FA:7E:7A:1B:79
\n
"
"a=setup:actpass
\n
"
"a=mid:audio
\n
"
"a=extmap:1/sendonly urn:ietf:params:rtp-hdrext:ssrc-audio-level
\n
"
"a=sendrecv
\n
"
"a=rtcp-mux
\n
"
"a=rtpmap:111 opus/48000/2
\n
"
"a=rtcp-fb:111 transport-cc
\n
"
"a=fmtp:111 minptime=10;useinbandfec=1
\n
"
"a=rtpmap:103 ISAC/16000
\n
"
"a=rtpmap:104 ISAC/32000
\n
"
"a=rtpmap:9 G722/8000
\n
"
"a=rtpmap:0 PCMU/8000
\n
"
"a=rtpmap:8 PCMA/8000
\n
"
"a=rtpmap:106 CN/32000
\n
"
"a=rtpmap:105 CN/16000
\n
"
"a=rtpmap:13 CN/8000
\n
"
"a=rtpmap:110 telephone-event/48000
\n
"
"a=rtpmap:112 telephone-event/32000
\n
"
"a=rtpmap:113 telephone-event/16000
\n
"
"a=rtpmap:126 telephone-event/8000
\n
"
"a=ssrc:120276603 cname:iSkJ2vn5cYYubTve
\n
"
"a=ssrc:120276603 msid:616cfbb1-33a3-4d8c-8275-a199d6005549 1da3d329-7399-4fe9-b20f-69606bebd363
\n
"
"a=ssrc:120276603 mslabel:616cfbb1-33a3-4d8c-8275-a199d6005549
\n
"
"a=ssrc:120276603 label:1da3d329-7399-4fe9-b20f-69606bebd363
\n
"
"m=video 9 UDP/TLS/RTP/SAVPF 96 98 100 102 127 97 99 101 125
\n
"
"c=IN IP4 0.0.0.0
\n
"
"a=rtcp:9 IN IP4 0.0.0.0
\n
"
"a=ice-ufrag:sXJ3
\n
"
"a=ice-pwd:yEclOTrLg1gEubBFefOqtmyV
\n
"
"a=fingerprint:sha-256 22:14:B5:AF:66:12:C7:C7:8D:EF:4B:DE:40:25:ED:5D:8F:17:54:DD:88:33:C0:13:2E:FD:1A:FA:7E:7A:1B:79
\n
"
"a=setup:actpass
\n
"
"a=mid:video
\n
"
"a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
\n
"
"a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
\n
"
"a=extmap:4 urn:3gpp:video-orientation
\n
"
"a=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
\n
"
"a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
\n
"
"a=sendrecv
\n
"
"a=rtcp-mux
\n
"
"a=rtcp-rsize
\n
"
"a=rtpmap:96 VP8/90000
\n
"
"a=rtcp-fb:96 ccm fir
\n
"
"a=rtcp-fb:96 nack
\n
"
"a=rtcp-fb:96 nack pli
\n
"
"a=rtcp-fb:96 goog-remb
\n
"
"a=rtcp-fb:96 transport-cc
\n
"
"a=rtpmap:98 VP9/90000
\n
"
"a=rtcp-fb:98 ccm fir
\n
"
"a=rtcp-fb:98 nack
\n
"
"a=rtcp-fb:98 nack pli
\n
"
"a=rtcp-fb:98 goog-remb
\n
"
"a=rtcp-fb:98 transport-cc
\n
"
"a=rtpmap:100 H264/90000
\n
"
"a=rtcp-fb:100 ccm fir
\n
"
"a=rtcp-fb:100 nack
\n
"
"a=rtcp-fb:100 nack pli
\n
"
"a=rtcp-fb:100 goog-remb
\n
"
"a=rtcp-fb:100 transport-cc
\n
"
"a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
\n
"
"a=rtpmap:102 red/90000
\n
"
"a=rtpmap:127 ulpfec/90000
\n
"
"a=rtpmap:97 rtx/90000
\n
"
"a=fmtp:97 apt=96
\n
"
"a=rtpmap:99 rtx/90000
\n
"
"a=fmtp:99 apt=98
\n
"
"a=rtpmap:101 rtx/90000
\n
"
"a=fmtp:101 apt=100
\n
"
"a=rtpmap:125 rtx/90000
\n
"
"a=fmtp:125 apt=102
\n
"
"a=ssrc-group:FID 2580761338 611523443
\n
"
"a=ssrc:2580761338 cname:iSkJ2vn5cYYubTve
\n
"
"a=ssrc:2580761338 msid:616cfbb1-33a3-4d8c-8275-a199d6005549 bf270496-a23e-47b5-b901-ef23096cd961
\n
"
"a=ssrc:2580761338 mslabel:616cfbb1-33a3-4d8c-8275-a199d6005549
\n
"
"a=ssrc:2580761338 label:bf270496-a23e-47b5-b901-ef23096cd961
\n
"
"a=ssrc:611523443 cname:iSkJ2vn5cYYubTve
\n
"
"a=ssrc:611523443 msid:616cfbb1-33a3-4d8c-8275-a199d6005549 bf270496-a23e-47b5-b901-ef23096cd961
\n
"
"a=ssrc:611523443 mslabel:616cfbb1-33a3-4d8c-8275-a199d6005549
\n
"
"a=ssrc:611523443 label:bf270496-a23e-47b5-b901-ef23096cd961
\n
"
"a=candidate:3575467457 1 udp 2113937151 10.15.83.23 57857 typ host generation 0 ufrag 6R0z network-cost 999
\n
"
"m=application 9 DTLS/SCTP 5000
\n
"
"c=IN IP4 0.0.0.0
\n
"
"a=ice-ufrag:sXJ3
\n
"
"a=ice-pwd:yEclOTrLg1gEubBFefOqtmyV
\n
"
"a=fingerprint:sha-256 22:14:B5:AF:66:12:C7:C7:8D:EF:4B:DE:40:25:ED:5D:8F:17:54:DD:88:33:C0:13:2E:FD:1A:FA:7E:7A:1B:79
\n
"
"a=setup:actpass
\n
"
"a=mid:data
\n
"
"a=sctpmap:5000 webrtc-datachannel 1024
\n
"
"a=sctp-port:5000"
;
RtcSessionSdp
sdp1
;
sdp1
.
parse
(
str1
);
RtcSessionSdp
sdp2
;
sdp2
.
parse
(
str2
);
for
(
auto
media
:
sdp1
.
medias
)
{
InfoL
<<
getRtpDirectionString
(
media
.
getDirection
());
}
for
(
auto
media
:
sdp2
.
medias
)
{
InfoL
<<
getRtpDirectionString
(
media
.
getDirection
());
}
InfoL
<<
sdp1
.
toString
();
InfoL
<<
sdp2
.
toString
();
RtcSession
session1
;
session1
.
loadFrom
(
str1
);
RtcSession
session2
;
session2
.
loadFrom
(
str2
);
DebugL
<<
session1
.
toString
();
DebugL
<<
session2
.
toString
();
}
int
start_main
(
int
argc
,
char
*
argv
[])
{
int
start_main
(
int
argc
,
char
*
argv
[])
{
{
{
CMD_main
cmd_main
;
CMD_main
cmd_main
;
...
@@ -414,7 +267,6 @@ int start_main(int argc,char *argv[]) {
...
@@ -414,7 +267,6 @@ int start_main(int argc,char *argv[]) {
});
});
}
}
// test_sdp();
uint16_t
shellPort
=
mINI
::
Instance
()[
Shell
::
kPort
];
uint16_t
shellPort
=
mINI
::
Instance
()[
Shell
::
kPort
];
uint16_t
rtspPort
=
mINI
::
Instance
()[
Rtsp
::
kPort
];
uint16_t
rtspPort
=
mINI
::
Instance
()[
Rtsp
::
kPort
];
uint16_t
rtspsPort
=
mINI
::
Instance
()[
Rtsp
::
kSSLPort
];
uint16_t
rtspsPort
=
mINI
::
Instance
()[
Rtsp
::
kSSLPort
];
...
...
src/Extension/CommonRtp.cpp
查看文件 @
29c8c9bf
...
@@ -69,7 +69,7 @@ CommonRtpEncoder::CommonRtpEncoder(CodecId codec, uint32_t ssrc, uint32_t mtu_si
...
@@ -69,7 +69,7 @@ CommonRtpEncoder::CommonRtpEncoder(CodecId codec, uint32_t ssrc, uint32_t mtu_si
}
}
void
CommonRtpEncoder
::
inputFrame
(
const
Frame
::
Ptr
&
frame
){
void
CommonRtpEncoder
::
inputFrame
(
const
Frame
::
Ptr
&
frame
){
auto
stamp
=
frame
->
d
ts
();
auto
stamp
=
frame
->
p
ts
();
auto
ptr
=
frame
->
data
()
+
frame
->
prefixSize
();
auto
ptr
=
frame
->
data
()
+
frame
->
prefixSize
();
auto
len
=
frame
->
size
()
-
frame
->
prefixSize
();
auto
len
=
frame
->
size
()
-
frame
->
prefixSize
();
auto
remain_size
=
len
;
auto
remain_size
=
len
;
...
...
src/Rtsp/Rtsp.cpp
查看文件 @
29c8c9bf
...
@@ -521,6 +521,10 @@ RtpHeader* RtpPacket::getHeader(){
...
@@ -521,6 +521,10 @@ RtpHeader* RtpPacket::getHeader(){
return
(
RtpHeader
*
)(
data
()
+
RtpPacket
::
kRtpTcpHeaderSize
);
return
(
RtpHeader
*
)(
data
()
+
RtpPacket
::
kRtpTcpHeaderSize
);
}
}
string
RtpPacket
::
dumpString
()
const
{
return
((
RtpPacket
*
)
this
)
->
getHeader
()
->
dumpString
(
size
()
-
RtpPacket
::
kRtpTcpHeaderSize
);
}
uint16_t
RtpPacket
::
getSeq
(){
uint16_t
RtpPacket
::
getSeq
(){
return
ntohs
(
getHeader
()
->
seq
);
return
ntohs
(
getHeader
()
->
seq
);
}
}
...
...
src/Rtsp/Rtsp.h
查看文件 @
29c8c9bf
...
@@ -150,7 +150,11 @@ public:
...
@@ -150,7 +150,11 @@ public:
kRtpTcpHeaderSize
=
4
kRtpTcpHeaderSize
=
4
};
};
//获取rtp头
RtpHeader
*
getHeader
();
RtpHeader
*
getHeader
();
//打印调试信息
string
dumpString
()
const
;
//主机字节序的seq
//主机字节序的seq
uint16_t
getSeq
();
uint16_t
getSeq
();
//主机字节序的时间戳,已经转换为毫秒
//主机字节序的时间戳,已经转换为毫秒
...
...
src/Rtsp/RtspMediaSourceImp.h
查看文件 @
29c8c9bf
...
@@ -56,7 +56,11 @@ public:
...
@@ -56,7 +56,11 @@ public:
//需要解复用rtp
//需要解复用rtp
key_pos
=
_demuxer
->
inputRtp
(
rtp
);
key_pos
=
_demuxer
->
inputRtp
(
rtp
);
}
}
RtspMediaSource
::
onWrite
(
std
::
move
(
rtp
),
key_pos
);
GET_CONFIG
(
bool
,
directProxy
,
Rtsp
::
kDirectProxy
);
if
(
directProxy
)
{
//直接代理模式才直接使用原始rtp
RtspMediaSource
::
onWrite
(
std
::
move
(
rtp
),
key_pos
);
}
}
}
/**
/**
...
@@ -72,8 +76,10 @@ public:
...
@@ -72,8 +76,10 @@ public:
* @param enableMP4 是否mp4录制
* @param enableMP4 是否mp4录制
*/
*/
void
setProtocolTranslation
(
bool
enableHls
,
bool
enableMP4
){
void
setProtocolTranslation
(
bool
enableHls
,
bool
enableMP4
){
//不重复生成rtsp
GET_CONFIG
(
bool
,
directProxy
,
Rtsp
::
kDirectProxy
);
_muxer
=
std
::
make_shared
<
MultiMediaSourceMuxer
>
(
getVhost
(),
getApp
(),
getId
(),
_demuxer
->
getDuration
(),
false
,
true
,
enableHls
,
enableMP4
);
//开启直接代理模式时,rtsp直接代理,不重复产生;但是有些rtsp推流端,由于sdp中已有sps pps,rtp中就不再包括sps pps,
//导致rtc无法播放,所以在rtsp推流rtc播放时,建议关闭直接代理模式
_muxer
=
std
::
make_shared
<
MultiMediaSourceMuxer
>
(
getVhost
(),
getApp
(),
getId
(),
_demuxer
->
getDuration
(),
!
directProxy
,
true
,
enableHls
,
enableMP4
);
_muxer
->
setMediaListener
(
getListener
());
_muxer
->
setMediaListener
(
getListener
());
_muxer
->
setTrackListener
(
static_pointer_cast
<
RtspMediaSourceImp
>
(
shared_from_this
()));
_muxer
->
setTrackListener
(
static_pointer_cast
<
RtspMediaSourceImp
>
(
shared_from_this
()));
//让_muxer对象拦截一部分事件(比如说录像相关事件)
//让_muxer对象拦截一部分事件(比如说录像相关事件)
...
...
webrtc/DtlsTransport.cpp
查看文件 @
29c8c9bf
#
define
MS_CLASS
"RTC::DtlsTransport"
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define MS_CLASS "RTC::DtlsTransport"
// #define MS_LOG_DEV_LEVEL 3
// #define MS_LOG_DEV_LEVEL 3
#include "DtlsTransport.hpp"
#include "DtlsTransport.hpp"
...
...
webrtc/DtlsTransport.hpp
查看文件 @
29c8c9bf
#
ifndef
MS_RTC_DTLS_TRANSPORT_HPP
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MS_RTC_DTLS_TRANSPORT_HPP
#define MS_RTC_DTLS_TRANSPORT_HPP
#define MS_RTC_DTLS_TRANSPORT_HPP
#include "SrtpSession.hpp"
#include "SrtpSession.hpp"
...
...
webrtc/IceServer.cpp
查看文件 @
29c8c9bf
#
define
MS_CLASS
"RTC::IceServer"
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define MS_CLASS "RTC::IceServer"
// #define MS_LOG_DEV_LEVEL 3
// #define MS_LOG_DEV_LEVEL 3
#include <utility>
#include <utility>
...
...
webrtc/IceServer.hpp
查看文件 @
29c8c9bf
#
ifndef
MS_RTC_ICE_SERVER_HPP
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MS_RTC_ICE_SERVER_HPP
#define MS_RTC_ICE_SERVER_HPP
#define MS_RTC_ICE_SERVER_HPP
#include "StunPacket.hpp"
#include "StunPacket.hpp"
...
...
webrtc/Sdp.cpp
查看文件 @
29c8c9bf
//
/*
// Created by xzl on 2021/3/27.
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
//
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#include "Sdp.h"
#include "Sdp.h"
#include "Common/Parser.h"
#include "Common/Parser.h"
...
...
webrtc/Sdp.h
查看文件 @
29c8c9bf
//
/*
// Created by xzl on 2021/3/27.
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
//
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifndef ZLMEDIAKIT_SDP_H
#ifndef ZLMEDIAKIT_SDP_H
#define ZLMEDIAKIT_SDP_H
#define ZLMEDIAKIT_SDP_H
...
...
webrtc/SrtpSession.cpp
查看文件 @
29c8c9bf
#
define
MS_CLASS
"RTC::SrtpSession"
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define MS_CLASS "RTC::SrtpSession"
// #define MS_LOG_DEV_LEVEL 3
// #define MS_LOG_DEV_LEVEL 3
#include "SrtpSession.hpp"
#include "SrtpSession.hpp"
...
@@ -226,7 +244,7 @@ namespace RTC
...
@@ -226,7 +244,7 @@ namespace RTC
}
}
std
::
memcpy
(
EncryptBuffer
,
*
data
,
*
len
);
std
::
memcpy
(
EncryptBuffer
,
*
data
,
*
len
);
EncryptBuffer
[
1
]
|=
(
pt
&
0x7F
);
EncryptBuffer
[
1
]
=
(
pt
&
0x7F
)
|
(
EncryptBuffer
[
1
]
&
0x80
);
srtp_err_status_t
err
=
srtp_err_status_t
err
=
srtp_protect
(
this
->
session
,
static_cast
<
void
*>
(
EncryptBuffer
),
reinterpret_cast
<
int
*>
(
len
));
srtp_protect
(
this
->
session
,
static_cast
<
void
*>
(
EncryptBuffer
),
reinterpret_cast
<
int
*>
(
len
));
...
...
webrtc/SrtpSession.hpp
查看文件 @
29c8c9bf
#
ifndef
MS_RTC_SRTP_SESSION_HPP
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MS_RTC_SRTP_SESSION_HPP
#define MS_RTC_SRTP_SESSION_HPP
#define MS_RTC_SRTP_SESSION_HPP
#include "Utils.hpp"
#include "Utils.hpp"
...
...
webrtc/StunPacket.cpp
查看文件 @
29c8c9bf
#
define
MS_CLASS
"RTC::StunPacket"
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#define MS_CLASS "RTC::StunPacket"
// #define MS_LOG_DEV_LEVEL 3
// #define MS_LOG_DEV_LEVEL 3
#include "StunPacket.hpp"
#include "StunPacket.hpp"
...
...
webrtc/StunPacket.hpp
查看文件 @
29c8c9bf
#
ifndef
MS_RTC_STUN_PACKET_HPP
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MS_RTC_STUN_PACKET_HPP
#define MS_RTC_STUN_PACKET_HPP
#define MS_RTC_STUN_PACKET_HPP
...
...
webrtc/Utils.hpp
查看文件 @
29c8c9bf
#
ifndef
MS_UTILS_HPP
/**
ISC License
Copyright © 2015, Iñaki Baz Castillo <ibc@aliax.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef MS_UTILS_HPP
#define MS_UTILS_HPP
#define MS_UTILS_HPP
#if defined(_WIN32)
#if defined(_WIN32)
...
...
webrtc/WebRtcTransport.cpp
查看文件 @
29c8c9bf
#
include
"WebRtcTransport.h"
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#include "WebRtcTransport.h"
#include <iostream>
#include <iostream>
#include "Rtcp/Rtcp.h"
#include "Rtcp/Rtcp.h"
#include "Rtsp/RtpReceiver.h"
#include "Rtsp/RtpReceiver.h"
...
@@ -583,7 +593,7 @@ void WebRtcTransportImp::onBeforeSortedRtp(const RtpPayloadInfo &info, const Rtp
...
@@ -583,7 +593,7 @@ void WebRtcTransportImp::onBeforeSortedRtp(const RtpPayloadInfo &info, const Rtp
void
WebRtcTransportImp
::
onSendRtp
(
const
RtpPacket
::
Ptr
&
rtp
,
bool
flush
){
void
WebRtcTransportImp
::
onSendRtp
(
const
RtpPacket
::
Ptr
&
rtp
,
bool
flush
){
auto
&
pt
=
_send_rtp_pt
[
rtp
->
type
];
auto
&
pt
=
_send_rtp_pt
[
rtp
->
type
];
if
(
!
pt
)
{
if
(
pt
==
0xFF
)
{
//忽略,对方不支持该编码类型
//忽略,对方不支持该编码类型
return
;
return
;
}
}
...
...
webrtc/WebRtcTransport.h
查看文件 @
29c8c9bf
#
pragma
once
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#pragma once
#include <memory>
#include <memory>
#include <string>
#include <string>
...
@@ -202,7 +212,7 @@ private:
...
@@ -202,7 +212,7 @@ private:
//rtc rtp推流的视频ssrc
//rtc rtp推流的视频ssrc
uint32_t
_recv_video_ssrc
;
uint32_t
_recv_video_ssrc
;
//记录协商的rtp的pt类型
//记录协商的rtp的pt类型
uint8_t
_send_rtp_pt
[
2
]
=
{
0
,
0
};
uint8_t
_send_rtp_pt
[
2
]
=
{
0
xFF
,
0xFF
};
//复合udp端口,接收一切rtp与rtcp
//复合udp端口,接收一切rtp与rtcp
Socket
::
Ptr
_socket
;
Socket
::
Ptr
_socket
;
//推流的rtsp源
//推流的rtsp源
...
...
webrtc/readme.md
0 → 100644
查看文件 @
29c8c9bf
# 致谢与声明
本文件夹下部分文件提取自
[
MediaSoup
](
https://github.com/versatica/mediasoup
)
,分别为:
-
ice相关功能:
-
IceServer.cpp
-
IceServer.hpp
-
StunPacket.cpp
-
StunPacket.hpp
-
Utils.hpp
-
dtls相关功能:
-
DtlsTransport.cpp
-
DtlsTransport.hpp
-
srtp相关功能:
-
SrtpSession.cpp
-
SrtpSession.hpp
以上源码有一定的修改和裁剪,感谢MediaSoup开源项目及作者,
用户在使用本项目的同时,应该同时遵循MediaSoup的开源协议。
同时,在此也感谢开源项目
[
easy_webrtc_server
](
https://github.com/Mihawk086/easy_webrtc_server
)
及作者,
在集成MediaSoup相关代码前期,主要参考这个项目。
另外,感谢
[
big panda
](
<
2381267071@qq.com
>
)
开发并贡献的webrtc js测试客户端(www/webrtc目录下文件),
其开源项目地址为:https://gitee.com/xiongguangjie/zlmrtcclient.js
# 现状与规划
ZLMediaKit的WebRTC相关功能目前仅供测试与开发,现在还不成熟,后续主要工作有:
-
1、完善webrtc rtcp相关功能,包括丢包重传、带宽检测等功能。
-
2、实现rtp重传等相关功能。
-
3、实现simulecast相关功能。
-
4、fec、rtp扩展等其他功能。
-
5、如果精力允许,逐步替换MediaSoup相关代码,改用自有版权代码。
www/webrtc/readme.txt
0 → 100644
查看文件 @
29c8c9bf
感谢[big panda](<2381267071@qq.com>) 开发并贡献此webrtc js测试客户端,
其开源项目地址为:https://gitee.com/xiongguangjie/zlmrtcclient.js
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论