mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-16 04:55:58 +08:00
feat: 增加webrtc代理拉流 (#4389)
- 增加客户端模式,支持主动拉流、推流: - addStreamProxy接口新增支持whep主动拉流,拉流地址目前只兼容zlm的whep url。 - addStreamPusherProxy接口新增支持whip主动推流,推流地址目前只兼容zlm的whip url。 - 以上推流url格式为webrtc[s]://server_host:server_port/app/stream_id?key=value, 内部会自动转换为http[s]://server_host:server_port/index/api/[whip/whep]?app=app&stream=stream_id&key=value。 - 增加WebRtc p2p 模式: - 增加 ICE FULL模式。 - 增加STUN/TURN 服务器。 - 增加websocket 信令。 - 增加P2P代理拉流。 --------- Co-authored-by: xia-chu <771730766@qq.com> Co-authored-by: mtdxc <mtdxc@126.com> Co-authored-by: cqm <cqm@97kid.com>
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
#if defined(ENABLE_WEBRTC)
|
||||
#include "../webrtc/WebRtcTransport.h"
|
||||
#include "../webrtc/WebRtcSession.h"
|
||||
#include "../webrtc/WebRtcSignalingSession.h"
|
||||
#include "../webrtc/IceSession.hpp"
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_SRT)
|
||||
@@ -368,8 +370,17 @@ int start_main(int argc,char *argv[]) {
|
||||
}
|
||||
return Socket::createSocket(new_poller, false);
|
||||
});
|
||||
|
||||
auto signaleSrv = std::make_shared<TcpServer>();
|
||||
auto signalsSrv = std::make_shared<TcpServer>();
|
||||
auto iceTcpSrv = std::make_shared<TcpServer>();
|
||||
auto iceSrv = std::make_shared<UdpServer>();
|
||||
uint16_t rtcPort = mINI::Instance()[Rtc::kPort];
|
||||
uint16_t rtcTcpPort = mINI::Instance()[Rtc::kTcpPort];
|
||||
uint16_t signalingPort = mINI::Instance()[Rtc::kSignalingPort];
|
||||
uint16_t signalSslPort = mINI::Instance()[Rtc::kSignalingSslPort];
|
||||
uint16_t icePort = mINI::Instance()[Rtc::kIcePort];
|
||||
uint16_t iceTcpPort = mINI::Instance()[Rtc::kIceTcpPort];
|
||||
#endif//defined(ENABLE_WEBRTC)
|
||||
|
||||
|
||||
@@ -435,6 +446,12 @@ int start_main(int argc,char *argv[]) {
|
||||
|
||||
if (rtcTcpPort) { rtcSrv_tcp->start<WebRtcSession>(rtcTcpPort, listen_ip);}
|
||||
|
||||
//webrtc 信令服务器
|
||||
if (signalingPort) { signaleSrv->start<WebRtcWebcosktSignalingSession>(signalingPort);}
|
||||
if (signalSslPort) { signalsSrv->start<WebRtcWebcosktSignalSslSession>(signalSslPort);}
|
||||
//STUN/TURN服务
|
||||
if (icePort) { iceSrv->start<IceSession>(icePort);}
|
||||
if (iceTcpPort) { iceTcpSrv->start<IceSession>(iceTcpPort);}
|
||||
#endif//defined(ENABLE_WEBRTC)
|
||||
|
||||
#if defined(ENABLE_SRT)
|
||||
|
||||
Reference in New Issue
Block a user