From eef0c31d7b934e88799e318d1e4198f4eb962610 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Thu, 17 Jun 2021 10:39:22 +0800 Subject: [PATCH] =?UTF-8?q?addStreamProxy=E6=96=B0=E5=A2=9E=E9=87=8D?= =?UTF-8?q?=E8=AF=95=E6=AC=A1=E6=95=B0=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 0eada8cc..328f1e05 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -697,10 +697,11 @@ void installWebApi() { const string &app, const string &stream, const string &url, + int retry_count, bool enable_hls, bool enable_mp4, int rtp_type, - float timeoutSec, + float timeout_sec, const function &cb){ auto key = getProxyKey(vhost,app,stream); lock_guard lck(s_proxyMapMtx); @@ -710,15 +711,15 @@ void installWebApi() { return; } //添加拉流代理 - PlayerProxy::Ptr player(new PlayerProxy(vhost, app, stream, enable_hls, enable_mp4)); + PlayerProxy::Ptr player(new PlayerProxy(vhost, app, stream, enable_hls, enable_mp4, retry_count ? retry_count : -1)); s_proxyMap[key] = player; - + //指定RTP over TCP(播放rtsp时有效) (*player)[kRtpType] = rtp_type; - if (timeoutSec > 0.1) { + if (timeout_sec > 0.1) { //播放握手超时时间 - (*player)[kTimeoutMS] = timeoutSec * 1000; + (*player)[kTimeoutMS] = timeout_sec * 1000; } //开始播放,如果播放失败或者播放中止,将会自动重试若干次,默认一直重试 @@ -747,6 +748,7 @@ void installWebApi() { allArgs["app"], allArgs["stream"], allArgs["url"], + allArgs["retry_count"], allArgs["enable_hls"],/* 是否hls转发 */ allArgs["enable_mp4"],/* 是否MP4录制 */ allArgs["rtp_type"], @@ -1240,6 +1242,7 @@ void installWebApi() { allArgs["stream"], /** 支持rtsp和rtmp方式拉流 ,rtsp支持h265/h264/aac,rtmp仅支持h264/aac **/ "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov", + -1,/*无限重试*/ true,/* 开启hls转发 */ false,/* 禁用MP4录制 */ 0,//rtp over tcp方式拉流