Browse Source

/*视频录像异常问题修改*/

master
htjcAdmin 3 months ago
parent
commit
28a9188bee
2 changed files with 17 additions and 9 deletions
  1. +5
    -4
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java
  2. +12
    -5
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java

+ 5
- 4
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsRecordController.java View File

@ -42,20 +42,21 @@ public class IvsRecordController {
@GetMapping({"start"})
public Response start(String streamid) {
log.debug("[RECORD] record start streamId:{}", streamid);
log.debug("START_RECORD record start streamId:{}", streamid);
String code = redisService.getCacheObject(String.format(IvsConst.IVS_STREAM_ID, streamid));
log.debug("START_RECORD record start code:{}", code);
IvsRecStartVo ivsRecStartVo = new IvsRecStartVo();
ivsRecStartVo.setCode(code);
String key = String.format(IvsConst.IVS_RECORD_START_TIME, streamid);
redisService.setCacheObject(key, DateUtils.dateTimeNow(), IvsConst.IVS_RECORD_START_TIME_EXPIRE, TimeUnit.MINUTES);
ivsCommonService.get(getLabel(), UriUtils.parse(IvsConst.URI_START_RECORD, ivsRecStartVo));
log.debug("[RECORD] record start end");
log.debug("START_RECORD record start end");
return Response.ok();
}
@GetMapping({"stop"})
public IvsRecStopView stop(String streamid) {
log.debug("[RECORD] record stop streamid:{}", streamid);
log.debug("STOP_RECORD record stop streamid:{}", streamid);
String key = String.format(IvsConst.IVS_STREAM_ID, streamid);
String code = redisService.getCacheObject(key);
IvsVo ivsRecordStartVo = new IvsVo();
@ -78,7 +79,7 @@ public class IvsRecordController {
key = String.format(IvsConst.IVS_DOWNLOAD_STREAM_ID, streamid);
redisService.setCacheObject(key, ivsRecStopView.toJSON(), IvsConst.IVS_STREAM_ID_EXPIRE, TimeUnit.HOURS);
log.debug("[RECORD] record stop end");
log.debug("STOP_RECORD record stop end streamid:{}", streamid);
return ivsRecStopView;
}


+ 12
- 5
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsStreamController.java View File

@ -3,6 +3,7 @@ package com.inspect.ivs.controller;
import com.inspect.base.core.domain.Response;
import com.inspect.base.core.utils.StringUtils;
import com.inspect.base.core.utils.uuid.UUID;
import com.inspect.base.redis.service.RedisService;
import com.inspect.ivs.constant.IvsConst;
import com.inspect.ivs.enums.RtspType;
import com.inspect.ivs.service.IvsCommonService;
@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping({"/api/v1/stream"})
public class IvsStreamController {
@ -34,6 +37,9 @@ public class IvsStreamController {
private final ZlMediaComponent zlMediaComponent;
private final XinTongComponent xinTongComponent;
@Resource
private RedisService redisService;
public IvsStreamController(IvsCommonService ivsCommonService, ZlMediaComponent zlMediaComponent, XinTongComponent xinTongComponent) {
this.ivsCommonService = ivsCommonService;
this.zlMediaComponent = zlMediaComponent;
@ -63,17 +69,18 @@ public class IvsStreamController {
}
log.debug("[IVS] {}", ivsVideoRtspView);
String handle = UUID.randomUUID().toString();
log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}", rtspType, rtspType.ordinal());
String streamId = UUID.randomUUID().toString();
redisService.setCacheObject(String.format(IvsConst.IVS_STREAM_ID, streamId), ivsVideoRtspVo.getCameraCode());
log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}, streamId: {}", rtspType, rtspType.ordinal(), streamId);
switch (rtspType.ordinal()) {
case 0:
zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView);
zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView);
break;
case 1:
xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView);
xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView);
}
IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(handle, ivsVideoRtspView);
IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(streamId, ivsVideoRtspView);
log.debug("[IVS] {}", ivsStreamStartView);
log.debug("[IVS] end");
return ivsStreamStartView;


Loading…
Cancel
Save