mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 11:41:44 +08:00
添加mk_rtp_server_start接口
This commit is contained in:
@@ -43,6 +43,13 @@ static TcpServer::Ptr rtsp_server[2];
|
||||
static TcpServer::Ptr rtmp_server[2];
|
||||
static TcpServer::Ptr http_server[2];
|
||||
|
||||
#ifdef ENABLE_RTPPROXY
|
||||
#include "Rtp/UdpRecver.h"
|
||||
#include "Rtp/RtpSession.h"
|
||||
static std::shared_ptr<UdpRecver> udpRtpServer;
|
||||
static TcpServer::Ptr tcpRtpServer(new TcpServer());
|
||||
#endif
|
||||
|
||||
//////////////////////////environment init///////////////////////////
|
||||
API_EXPORT void API_CALL mk_env_init(const config *cfg) {
|
||||
assert(cfg);
|
||||
@@ -129,6 +136,28 @@ API_EXPORT uint16_t API_CALL mk_rtmp_server_start(uint16_t port, int ssl) {
|
||||
}
|
||||
}
|
||||
|
||||
API_EXPORT uint16_t API_CALL mk_rtp_server_start(uint16_t port){
|
||||
#ifdef ENABLE_RTPPROXY
|
||||
try {
|
||||
//创建rtp tcp服务器
|
||||
tcpRtpServer->start<RtpSession>(port);
|
||||
auto ret = tcpRtpServer->getPort();
|
||||
udpRtpServer = std::make_shared<UdpRecver>();
|
||||
//创建rtp udp服务器
|
||||
udpRtpServer->initSock(port);
|
||||
return ret;
|
||||
} catch (std::exception &ex) {
|
||||
tcpRtpServer.reset();
|
||||
udpRtpServer.reset();
|
||||
WarnL << ex.what();
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
WarnL << "未启用该功能!";
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
API_EXPORT void API_CALL mk_log_printf(int level, const char *file, const char *function, int line, const char *fmt, ...) {
|
||||
assert(file && function && fmt);
|
||||
LogContextCapturer info(Logger::Instance(), (LogLevel) level, file, function, line);
|
||||
|
||||
Reference in New Issue
Block a user