Commit 3042129544704fd809135635f9d8d45b7fee33bb
Merge remote-tracking branch 'origin/CommonTenant' into CommonTenant
Showing
6 changed files
with
26 additions
and
14 deletions
@@ -10,10 +10,13 @@ import org.json.JSONObject; | @@ -10,10 +10,13 @@ import org.json.JSONObject; | ||
10 | import org.springframework.web.bind.annotation.*; | 10 | import org.springframework.web.bind.annotation.*; |
11 | import org.springframework.web.context.request.async.DeferredResult; | 11 | import org.springframework.web.context.request.async.DeferredResult; |
12 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 12 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
13 | +import org.thingsboard.server.common.data.yunteng.config.media.UserSetting; | ||
13 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 14 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
15 | +import org.thingsboard.server.common.data.yunteng.dto.sip.MediaServerDTO; | ||
14 | import org.thingsboard.server.common.data.yunteng.dto.sip.VideoChanelDTO; | 16 | import org.thingsboard.server.common.data.yunteng.dto.sip.VideoChanelDTO; |
15 | import org.thingsboard.server.common.data.yunteng.dto.sip.hook.param.*; | 17 | import org.thingsboard.server.common.data.yunteng.dto.sip.hook.param.*; |
16 | import org.thingsboard.server.controller.BaseController; | 18 | import org.thingsboard.server.controller.BaseController; |
19 | +import org.thingsboard.server.dao.yunteng.service.media.TkCacheStorageService; | ||
17 | import org.thingsboard.server.dao.yunteng.service.media.TkMediaServerService; | 20 | import org.thingsboard.server.dao.yunteng.service.media.TkMediaServerService; |
18 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; | 21 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; |
19 | import org.thingsboard.server.queue.util.TbCoreComponent; | 22 | import org.thingsboard.server.queue.util.TbCoreComponent; |
@@ -27,9 +30,11 @@ import org.thingsboard.server.service.yunteng.media.TkVideoControlService; | @@ -27,9 +30,11 @@ import org.thingsboard.server.service.yunteng.media.TkVideoControlService; | ||
27 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
28 | @Slf4j | 31 | @Slf4j |
29 | public class ZLMediaKitHookController extends BaseController { | 32 | public class ZLMediaKitHookController extends BaseController { |
33 | + private final TkCacheStorageService tkCacheStorageService; | ||
30 | private final TkMediaServerService tkMediaServerService; | 34 | private final TkMediaServerService tkMediaServerService; |
31 | private final TkVideoChannelService tkVideoChannelService; | 35 | private final TkVideoChannelService tkVideoChannelService; |
32 | private final TkVideoControlService controlService; | 36 | private final TkVideoControlService controlService; |
37 | + private final UserSetting userSetting; | ||
33 | 38 | ||
34 | @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8") | 39 | @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8") |
35 | @ApiOperation(value = "保持流媒体服务器的心跳") | 40 | @ApiOperation(value = "保持流媒体服务器的心跳") |
@@ -93,12 +98,11 @@ public class ZLMediaKitHookController extends BaseController { | @@ -93,12 +98,11 @@ public class ZLMediaKitHookController extends BaseController { | ||
93 | 98 | ||
94 | DeferredResult<HookResult> defaultResult = new DeferredResult<>(); | 99 | DeferredResult<HookResult> defaultResult = new DeferredResult<>(); |
95 | 100 | ||
96 | - // MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId()); | ||
97 | - // if (!userSetting.isAutoApplyPlay() || mediaInfo == null) { | ||
98 | - // defaultResult.setResult(new HookResult(ErrorCode.ERROR404.getCode(), | ||
99 | - // ErrorCode.ERROR404.getMsg())); | ||
100 | - // return defaultResult; | ||
101 | - // } | 101 | + MediaServerDTO mediaServerItem = tkCacheStorageService.findInfoByMediaServerId(param.getMediaServerId()); |
102 | + if (!userSetting.getAutoApplyPlay() || mediaServerItem == null) { | ||
103 | + defaultResult.setResult(new HookResult(404,"资源未找到")); | ||
104 | + return defaultResult; | ||
105 | + } | ||
102 | // | 106 | // |
103 | // if ("rtp".equals(param.getApp())) { | 107 | // if ("rtp".equals(param.getApp())) { |
104 | // String[] s = param.getStream().split("_"); | 108 | // String[] s = param.getStream().split("_"); |
@@ -997,7 +997,7 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -997,7 +997,7 @@ public class DefaultTransportApiService implements TransportApiService { | ||
997 | log.info("启动流媒体【ZLMedia】验证,流媒体编号【{}】", mediaServerItem.getMediaServerId()); | 997 | log.info("启动流媒体【ZLMedia】验证,流媒体编号【{}】", mediaServerItem.getMediaServerId()); |
998 | JsonNode responseJson = zlMediaKitRestFulUtils.getMediaServerConfig(mediaServerItem); | 998 | JsonNode responseJson = zlMediaKitRestFulUtils.getMediaServerConfig(mediaServerItem); |
999 | if (responseJson == null) { | 999 | if (responseJson == null) { |
1000 | - log.error( | 1000 | + log.trace( |
1001 | "流媒体【{}】服务地址【{}:{}】无法访问", | 1001 | "流媒体【{}】服务地址【{}:{}】无法访问", |
1002 | mediaServerItem.getMediaServerId(), | 1002 | mediaServerItem.getMediaServerId(), |
1003 | mediaServerItem.getIp(), | 1003 | mediaServerItem.getIp(), |
@@ -1011,7 +1011,7 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -1011,7 +1011,7 @@ public class DefaultTransportApiService implements TransportApiService { | ||
1011 | return org.thingsboard.server.common.data.yunteng.utils.JacksonUtil.convertValue( | 1011 | return org.thingsboard.server.common.data.yunteng.utils.JacksonUtil.convertValue( |
1012 | data.get(0), ZLMediaKitServerConfig.class); | 1012 | data.get(0), ZLMediaKitServerConfig.class); |
1013 | } else { | 1013 | } else { |
1014 | - log.error( | 1014 | + log.trace( |
1015 | "流媒体【{}:{}】调用失败,失败原因【{}】", | 1015 | "流媒体【{}:{}】调用失败,失败原因【{}】", |
1016 | mediaServerItem.getIp(), | 1016 | mediaServerItem.getIp(), |
1017 | mediaServerItem.getHttpPort(), | 1017 | mediaServerItem.getHttpPort(), |
@@ -7,12 +7,19 @@ import org.springframework.stereotype.Component; | @@ -7,12 +7,19 @@ import org.springframework.stereotype.Component; | ||
7 | @Data | 7 | @Data |
8 | public class UserSetting { | 8 | public class UserSetting { |
9 | private String serverId = "000000"; | 9 | private String serverId = "000000"; |
10 | + /**部分设备需要扩展SDP,需要打开此设置*/ | ||
10 | private Boolean seniorSdp = Boolean.FALSE; | 11 | private Boolean seniorSdp = Boolean.FALSE; |
11 | private Boolean pushAuthority = Boolean.TRUE; | 12 | private Boolean pushAuthority = Boolean.TRUE; |
13 | + /**国标是否录制*/ | ||
12 | private Boolean recordSip = Boolean.TRUE; | 14 | private Boolean recordSip = Boolean.TRUE; |
15 | + /**推流直播是否录制*/ | ||
13 | private Boolean recordPushLive = Boolean.TRUE; | 16 | private Boolean recordPushLive = Boolean.TRUE; |
14 | private String recordPath = null; | 17 | private String recordPath = null; |
18 | + /**国标点播 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放*/ | ||
15 | private Boolean streamOnDemand = Boolean.TRUE; | 19 | private Boolean streamOnDemand = Boolean.TRUE; |
16 | private Boolean sipUseSourceIpAsRemoteAddress = Boolean.FALSE; | 20 | private Boolean sipUseSourceIpAsRemoteAddress = Boolean.FALSE; |
21 | + /***点播等待超时时间,单位:毫秒*/ | ||
17 | private Integer playTimeout = 30000; | 22 | private Integer playTimeout = 30000; |
23 | + /**自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true*/ | ||
24 | + private Boolean autoApplyPlay = Boolean.FALSE; | ||
18 | } | 25 | } |
@@ -145,7 +145,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | @@ -145,7 +145,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | ||
145 | CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); | 145 | CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME); |
146 | String methodName = cseqHeader.getMethod(); | 146 | String methodName = cseqHeader.getMethod(); |
147 | SIPResponse request = (SIPResponse) responseEvent.getResponse(); | 147 | SIPResponse request = (SIPResponse) responseEvent.getResponse(); |
148 | - log.info( | 148 | + log.trace( |
149 | "收到ResponseEvent,方法类型【{}】,状态码【{}】,事件内容【{}】", | 149 | "收到ResponseEvent,方法类型【{}】,状态码【{}】,事件内容【{}】", |
150 | methodName, | 150 | methodName, |
151 | status, | 151 | status, |
@@ -181,7 +181,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | @@ -181,7 +181,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | ||
181 | } else if ((status >= Response.TRYING) && (status < Response.OK)) { | 181 | } else if ((status >= Response.TRYING) && (status < Response.OK)) { |
182 | // 增加其它无需回复的响应,如101、180等 | 182 | // 增加其它无需回复的响应,如101、180等 |
183 | } else { | 183 | } else { |
184 | - log.error( | 184 | + log.trace( |
185 | "收到ResponseEvent,设备【{}】,状态码【{}】,失败原因【{}】,ResponseEvent内容【{}】", | 185 | "收到ResponseEvent,设备【{}】,状态码【{}】,失败原因【{}】,ResponseEvent内容【{}】", |
186 | response.getHeader(FromHeader.NAME), | 186 | response.getHeader(FromHeader.NAME), |
187 | status, | 187 | status, |
@@ -214,7 +214,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | @@ -214,7 +214,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | ||
214 | public void processRequest(RequestEvent requestEvent) { | 214 | public void processRequest(RequestEvent requestEvent) { |
215 | String methodName = requestEvent.getRequest().getMethod(); | 215 | String methodName = requestEvent.getRequest().getMethod(); |
216 | SIPRequest request = (SIPRequest) requestEvent.getRequest(); | 216 | SIPRequest request = (SIPRequest) requestEvent.getRequest(); |
217 | - log.info( | 217 | + log.trace( |
218 | "收到RequestEvent,方法类型【{}】,事件内容【{}】", | 218 | "收到RequestEvent,方法类型【{}】,事件内容【{}】", |
219 | methodName, | 219 | methodName, |
220 | request.getRawContent() == null ? null : new String(request.getRawContent())); | 220 | request.getRawContent() == null ? null : new String(request.getRawContent())); |
@@ -477,7 +477,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | @@ -477,7 +477,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | ||
477 | } catch (ParseException | InvalidArgumentException | SipException ex) { | 477 | } catch (ParseException | InvalidArgumentException | SipException ex) { |
478 | throw new RuntimeException(ex); | 478 | throw new RuntimeException(ex); |
479 | } | 479 | } |
480 | - log.error("摄像头【{}】使用凭证【{}】在平台进行鉴权失败。", camaraAddress, deviceId, e); | 480 | + log.trace("摄像头【{}】使用凭证【{}】在平台进行鉴权失败。", camaraAddress, deviceId, e); |
481 | } | 481 | } |
482 | }); | 482 | }); |
483 | 483 | ||
@@ -779,7 +779,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | @@ -779,7 +779,7 @@ public class SIPProcessorObserver extends SIPRequestProcessorParent | ||
779 | UUID sessionId, TransportProtos.ToDeviceRpcRequestMsg rpcRequest) { | 779 | UUID sessionId, TransportProtos.ToDeviceRpcRequestMsg rpcRequest) { |
780 | 780 | ||
781 | try { | 781 | try { |
782 | - log.error("【{}】下发RPC命令【{}】", sessionId, rpcRequest.getParams()); | 782 | + log.trace("【{}】下发RPC命令【{}】", sessionId, rpcRequest.getParams()); |
783 | JsonNode rpcBody = JacksonUtil.toJsonNode(rpcRequest.getParams()); | 783 | JsonNode rpcBody = JacksonUtil.toJsonNode(rpcRequest.getParams()); |
784 | String cameraCode = rpcParamVal(rpcBody, FastIotConstants.ZLMediaBody.CAMERA_CODE); | 784 | String cameraCode = rpcParamVal(rpcBody, FastIotConstants.ZLMediaBody.CAMERA_CODE); |
785 | GbtDeviceSessionCtx devSession = deviceSessions.get(cameraCode); | 785 | GbtDeviceSessionCtx devSession = deviceSessions.get(cameraCode); |
@@ -90,7 +90,7 @@ public class TcpGatewayDeviceSessionCtx extends TcpDeviceWareSessionContext impl | @@ -90,7 +90,7 @@ public class TcpGatewayDeviceSessionCtx extends TcpDeviceWareSessionContext impl | ||
90 | 90 | ||
91 | @Override | 91 | @Override |
92 | public void onToDeviceRpcRequest(UUID sessionId, TransportProtos.ToDeviceRpcRequestMsg request) { | 92 | public void onToDeviceRpcRequest(UUID sessionId, TransportProtos.ToDeviceRpcRequestMsg request) { |
93 | - log.error("【{}】下发RPC命令【{}】给网关子设备", sessionId, request.getParams()); | 93 | + log.trace("【{}】下发RPC命令【{}】给网关子设备", sessionId, request.getParams()); |
94 | try { | 94 | try { |
95 | parent.getPayloadAdaptor().convertToPublish(this, request).ifPresent( | 95 | parent.getPayloadAdaptor().convertToPublish(this, request).ifPresent( |
96 | payload -> { | 96 | payload -> { |
@@ -45,6 +45,7 @@ public class SSRCFactory { | @@ -45,6 +45,7 @@ public class SSRCFactory { | ||
45 | cacheUtils.invalidate(cacheName, redisKey); | 45 | cacheUtils.invalidate(cacheName, redisKey); |
46 | } | 46 | } |
47 | // 把这10000个ssrc放入缓存 | 47 | // 把这10000个ssrc放入缓存 |
48 | + log.error("初始化SSRC资源,可用资源数【{}】", ssrcList.size()); | ||
48 | cacheUtils.put(cacheName, redisKey, ssrcList); | 49 | cacheUtils.put(cacheName, redisKey, ssrcList); |
49 | }); | 50 | }); |
50 | } | 51 | } |