mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-01 23:57:37 +08:00
支持绑定到指定网卡 (#3760)
This commit is contained in:
@@ -84,6 +84,7 @@ const string kWaitTrackReadyMS = GENERAL_FIELD "wait_track_ready_ms";
|
||||
const string kWaitAddTrackMS = GENERAL_FIELD "wait_add_track_ms";
|
||||
const string kUnreadyFrameCache = GENERAL_FIELD "unready_frame_cache";
|
||||
const string kBroadcastPlayerCountChanged = GENERAL_FIELD "broadcast_player_count_changed";
|
||||
const string kListenIP = GENERAL_FIELD "listen_ip";
|
||||
|
||||
static onceToken token([]() {
|
||||
mINI::Instance()[kFlowThreshold] = 1024;
|
||||
@@ -99,6 +100,7 @@ static onceToken token([]() {
|
||||
mINI::Instance()[kWaitAddTrackMS] = 3000;
|
||||
mINI::Instance()[kUnreadyFrameCache] = 100;
|
||||
mINI::Instance()[kBroadcastPlayerCountChanged] = 0;
|
||||
mINI::Instance()[kListenIP] = "::";
|
||||
});
|
||||
|
||||
} // namespace General
|
||||
|
||||
@@ -202,6 +202,8 @@ extern const std::string kWaitAddTrackMS;
|
||||
extern const std::string kUnreadyFrameCache;
|
||||
// 是否启用观看人数变化事件广播,置1则启用,置0则关闭
|
||||
extern const std::string kBroadcastPlayerCountChanged;
|
||||
// 绑定的本地网卡ip
|
||||
extern const std::string kListenIP;
|
||||
} // namespace General
|
||||
|
||||
namespace Protocol {
|
||||
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
std::shared_ptr<struct sockaddr_storage> _rtcp_addr;
|
||||
};
|
||||
|
||||
void RtpServer::start(uint16_t local_port, const MediaTuple &tuple, TcpMode tcp_mode, const char *local_ip, bool re_use_port, uint32_t ssrc, int only_track, bool multiplex) {
|
||||
void RtpServer::start(uint16_t local_port, const char *local_ip, const MediaTuple &tuple, TcpMode tcp_mode, bool re_use_port, uint32_t ssrc, int only_track, bool multiplex) {
|
||||
//创建udp服务器
|
||||
auto poller = EventPollerPool::Instance().getPoller();
|
||||
Socket::Ptr rtp_socket = Socket::createSocket(poller, true);
|
||||
|
||||
@@ -36,15 +36,15 @@ public:
|
||||
/**
|
||||
* 开启服务器,可能抛异常
|
||||
* @param local_port 本地端口,0时为随机端口
|
||||
* @param local_ip 绑定的本地网卡ip
|
||||
* @param stream_id 流id,置空则使用ssrc
|
||||
* @param tcp_mode tcp服务模式
|
||||
* @param local_ip 绑定的本地网卡ip
|
||||
* @param re_use_port 是否设置socket为re_use属性
|
||||
* @param ssrc 指定的ssrc
|
||||
* @param multiplex 多路复用
|
||||
*/
|
||||
void start(uint16_t local_port, const MediaTuple &tuple = MediaTuple{DEFAULT_VHOST, kRtpAppName, "", ""}, TcpMode tcp_mode = PASSIVE,
|
||||
const char *local_ip = "::", bool re_use_port = true, uint32_t ssrc = 0, int only_track = 0, bool multiplex = false);
|
||||
void start(uint16_t local_port, const char *local_ip = "::", const MediaTuple &tuple = MediaTuple{DEFAULT_VHOST, kRtpAppName, "", ""}, TcpMode tcp_mode = PASSIVE,
|
||||
bool re_use_port = true, uint32_t ssrc = 0, int only_track = 0, bool multiplex = false);
|
||||
|
||||
/**
|
||||
* 连接到tcp服务(tcp主动模式)
|
||||
|
||||
Reference in New Issue
Block a user