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,14 +594,14 @@ public class DefaultDeviceStateService extends AbstractPartitionBasedService<Dev | ||
594 | && stateData.getDeviceCreationTime() + state.getInactivityTimeout() <= ts) { | 594 | && stateData.getDeviceCreationTime() + state.getInactivityTimeout() <= ts) { |
595 | if (partitionService.resolve(ServiceType.TB_CORE, stateData.getTenantId(), deviceId).isMyPartition()) { | 595 | if (partitionService.resolve(ServiceType.TB_CORE, stateData.getTenantId(), deviceId).isMyPartition()) { |
596 | reportInactivity(ts, deviceId, stateData); | 596 | reportInactivity(ts, deviceId, stateData); |
597 | - //thingskit update tkDevice state | ||
598 | - channelService.updateVideoChannelState(deviceId.getId().toString(), StatusEnum.OFFLINE); | ||
599 | if(stateData.getState().getLastActivityTime()>0){ | 597 | if(stateData.getState().getLastActivityTime()>0){ |
600 | String tenantId = stateData.getTenantId().getId().toString(); | 598 | String tenantId = stateData.getTenantId().getId().toString(); |
601 | String tbDeviceId = deviceId.getId().toString(); | 599 | String tbDeviceId = deviceId.getId().toString(); |
602 | tkDeviceService.updateDeviceStateByTbDeviceId(tenantId,tbDeviceId, | 600 | tkDeviceService.updateDeviceStateByTbDeviceId(tenantId,tbDeviceId, |
603 | org.thingsboard.server.common.data.yunteng.enums.DeviceState.OFFLINE); | 601 | org.thingsboard.server.common.data.yunteng.enums.DeviceState.OFFLINE); |
604 | saveDeviceStateLog(tenantId,tbDeviceId, FastIotConstants.StateValue.OFFLINE); | 602 | saveDeviceStateLog(tenantId,tbDeviceId, FastIotConstants.StateValue.OFFLINE); |
603 | + //thingskit update tkDevice state | ||
604 | + channelService.updateVideoChannelState(deviceId.getId().toString(), StatusEnum.OFFLINE); | ||
605 | } | 605 | } |
606 | } else { | 606 | } else { |
607 | cleanupEntity(deviceId); | 607 | cleanupEntity(deviceId); |
@@ -162,16 +162,17 @@ public class TkVideoControlServiceImpl implements TkVideoControlService { | @@ -162,16 +162,17 @@ public class TkVideoControlServiceImpl implements TkVideoControlService { | ||
162 | "【流媒体SIP】收到【视频点播】结果=异常【{}】+数据【{}】", | 162 | "【流媒体SIP】收到【视频点播】结果=异常【{}】+数据【{}】", |
163 | fromDeviceRpcResponse.getError(), | 163 | fromDeviceRpcResponse.getError(), |
164 | fromDeviceRpcResponse.getResponse()); | 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 | timeoutLatch.countDown(); | 176 | timeoutLatch.countDown(); |
176 | }); | 177 | }); |
177 | } catch (ThingsboardException e) { | 178 | } catch (ThingsboardException e) { |
@@ -101,6 +101,9 @@ public class TKSipUtils { | @@ -101,6 +101,9 @@ public class TKSipUtils { | ||
101 | } | 101 | } |
102 | 102 | ||
103 | public static VideoChanelDTO updateGps(VideoChanelDTO deviceChannel, String geoCoordSys) { | 103 | public static VideoChanelDTO updateGps(VideoChanelDTO deviceChannel, String geoCoordSys) { |
104 | + if (deviceChannel == null) { | ||
105 | + return null; | ||
106 | + } | ||
104 | if (deviceChannel.getLongitude() * deviceChannel.getLatitude() > 0) { | 107 | if (deviceChannel.getLongitude() * deviceChannel.getLatitude() > 0) { |
105 | 108 | ||
106 | if (geoCoordSys == null) { | 109 | if (geoCoordSys == null) { |
@@ -338,7 +338,7 @@ public class TkMediaServerServiceImpl | @@ -338,7 +338,7 @@ public class TkMediaServerServiceImpl | ||
338 | 338 | ||
339 | @Override | 339 | @Override |
340 | public HookResult zlmOnStreamChanged(OnStreamChangedHookParam param) { | 340 | public HookResult zlmOnStreamChanged(OnStreamChangedHookParam param) { |
341 | - log.error( | 341 | + log.info( |
342 | "WEBHOOK流(rtsp/rtmp)【on_stream_changed】{}应用【{}】的【{}/{}】协议,数据产生速度【{}】", | 342 | "WEBHOOK流(rtsp/rtmp)【on_stream_changed】{}应用【{}】的【{}/{}】协议,数据产生速度【{}】", |
343 | param.isRegist() ? "注册" : "注销", | 343 | param.isRegist() ? "注册" : "注销", |
344 | param.getApp(), | 344 | param.getApp(), |
@@ -539,7 +539,7 @@ public class TkMediaServerServiceImpl | @@ -539,7 +539,7 @@ public class TkMediaServerServiceImpl | ||
539 | 539 | ||
540 | @Override | 540 | @Override |
541 | public JsonNode zlmOnStreamNoneReader(OnStreamNoneReaderHookParam param) { | 541 | public JsonNode zlmOnStreamNoneReader(OnStreamNoneReaderHookParam param) { |
542 | - log.error( | 542 | + log.info( |
543 | "WEBHOOK流【on_stream_none_reader】应用【{}】的【{}】协议,流ID【{}】", | 543 | "WEBHOOK流【on_stream_none_reader】应用【{}】的【{}】协议,流ID【{}】", |
544 | param.getApp(), | 544 | param.getApp(), |
545 | param.getSchema(), | 545 | param.getSchema(), |