Commit 267b5ff59619cb404024fed269032e6146d26c8b
Merge branch 'fix_webcam' into 'master_dev'
fix: 调整视频通道的更新 See merge request yunteng/thingskit!396
Showing
4 changed files
with
18 additions
and
14 deletions
... | ... | @@ -594,14 +594,14 @@ public class DefaultDeviceStateService extends AbstractPartitionBasedService<Dev |
594 | 594 | && stateData.getDeviceCreationTime() + state.getInactivityTimeout() <= ts) { |
595 | 595 | if (partitionService.resolve(ServiceType.TB_CORE, stateData.getTenantId(), deviceId).isMyPartition()) { |
596 | 596 | reportInactivity(ts, deviceId, stateData); |
597 | - //thingskit update tkDevice state | |
598 | - channelService.updateVideoChannelState(deviceId.getId().toString(), StatusEnum.OFFLINE); | |
599 | 597 | if(stateData.getState().getLastActivityTime()>0){ |
600 | 598 | String tenantId = stateData.getTenantId().getId().toString(); |
601 | 599 | String tbDeviceId = deviceId.getId().toString(); |
602 | 600 | tkDeviceService.updateDeviceStateByTbDeviceId(tenantId,tbDeviceId, |
603 | 601 | org.thingsboard.server.common.data.yunteng.enums.DeviceState.OFFLINE); |
604 | 602 | saveDeviceStateLog(tenantId,tbDeviceId, FastIotConstants.StateValue.OFFLINE); |
603 | + //thingskit update tkDevice state | |
604 | + channelService.updateVideoChannelState(deviceId.getId().toString(), StatusEnum.OFFLINE); | |
605 | 605 | } |
606 | 606 | } else { |
607 | 607 | cleanupEntity(deviceId); | ... | ... |
... | ... | @@ -162,16 +162,17 @@ public class TkVideoControlServiceImpl implements TkVideoControlService { |
162 | 162 | "【流媒体SIP】收到【视频点播】结果=异常【{}】+数据【{}】", |
163 | 163 | fromDeviceRpcResponse.getError(), |
164 | 164 | fromDeviceRpcResponse.getResponse()); |
165 | - fromDeviceRpcResponse | |
166 | - .getResponse() | |
167 | - .ifPresent( | |
168 | - jsonStr -> { | |
169 | - if (fromDeviceRpcResponse.getError().isEmpty()) { | |
170 | - result.set(jsonStr); | |
171 | - } else { | |
172 | - result.set(fromDeviceRpcResponse.getError().get().name()); | |
173 | - } | |
174 | - }); | |
165 | + StatusEnum status = StatusEnum.ONLINE; | |
166 | + if(fromDeviceRpcResponse.getError().isPresent()){ | |
167 | + String errorCodeName = fromDeviceRpcResponse.getError().get().name(); | |
168 | + result.set(errorCodeName); | |
169 | + if("NO_ACTIVE_CONNECTION".equals(errorCodeName)){ | |
170 | + status = StatusEnum.OFFLINE; | |
171 | + } | |
172 | + }else { | |
173 | + result.set(fromDeviceRpcResponse.getResponse().get()); | |
174 | + } | |
175 | + tkVideoChannelService.updateVideoChannelState(deviceDTO.getTbDeviceId(),status); | |
175 | 176 | timeoutLatch.countDown(); |
176 | 177 | }); |
177 | 178 | } catch (ThingsboardException e) { | ... | ... |
... | ... | @@ -101,6 +101,9 @@ public class TKSipUtils { |
101 | 101 | } |
102 | 102 | |
103 | 103 | public static VideoChanelDTO updateGps(VideoChanelDTO deviceChannel, String geoCoordSys) { |
104 | + if (deviceChannel == null) { | |
105 | + return null; | |
106 | + } | |
104 | 107 | if (deviceChannel.getLongitude() * deviceChannel.getLatitude() > 0) { |
105 | 108 | |
106 | 109 | if (geoCoordSys == null) { | ... | ... |
... | ... | @@ -338,7 +338,7 @@ public class TkMediaServerServiceImpl |
338 | 338 | |
339 | 339 | @Override |
340 | 340 | public HookResult zlmOnStreamChanged(OnStreamChangedHookParam param) { |
341 | - log.error( | |
341 | + log.info( | |
342 | 342 | "WEBHOOK流(rtsp/rtmp)【on_stream_changed】{}应用【{}】的【{}/{}】协议,数据产生速度【{}】", |
343 | 343 | param.isRegist() ? "注册" : "注销", |
344 | 344 | param.getApp(), |
... | ... | @@ -539,7 +539,7 @@ public class TkMediaServerServiceImpl |
539 | 539 | |
540 | 540 | @Override |
541 | 541 | public JsonNode zlmOnStreamNoneReader(OnStreamNoneReaderHookParam param) { |
542 | - log.error( | |
542 | + log.info( | |
543 | 543 | "WEBHOOK流【on_stream_none_reader】应用【{}】的【{}】协议,流ID【{}】", |
544 | 544 | param.getApp(), |
545 | 545 | param.getSchema(), | ... | ... |