Commit 08c45876df5121b5b750798bae3e658f0ec575c6
1 parent
20082441
优化倍速播放参数
Showing
3 changed files
with
10 additions
and
5 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -1630,12 +1630,12 @@ public class SIPCommander implements ISIPCommander { |
| 1630 | 1630 | * 回放倍速播放 |
| 1631 | 1631 | */ |
| 1632 | 1632 | @Override |
| 1633 | - public void playSpeedCmd(Device device, StreamInfo streamInfo, String speed) { | |
| 1633 | + public void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) { | |
| 1634 | 1634 | try { |
| 1635 | 1635 | StringBuffer content = new StringBuffer(200); |
| 1636 | 1636 | content.append("PLAY RTSP/1.0\r\n"); |
| 1637 | 1637 | content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n"); |
| 1638 | - content.append("Scale: " + speed + ".000000\r\n"); | |
| 1638 | + content.append("Scale: " + String.format("%.1f",speed) + "\r\n"); | |
| 1639 | 1639 | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString()); |
| 1640 | 1640 | logger.info(request.toString()); |
| 1641 | 1641 | ClientTransaction clientTransaction = null; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| ... | ... | @@ -221,10 +221,10 @@ public class PlaybackController { |
| 221 | 221 | @ApiOperation("回放倍速播放") |
| 222 | 222 | @ApiImplicitParams({ |
| 223 | 223 | @ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class), |
| 224 | - @ApiImplicitParam(name = "speed", value = "倍速 1、2、4", dataTypeClass = String.class), | |
| 224 | + @ApiImplicitParam(name = "speed", value = "倍速0.25 0.5 1、2、4", dataTypeClass = Double.class), | |
| 225 | 225 | }) |
| 226 | 226 | @GetMapping("/speed/{streamId}/{speed}") |
| 227 | - public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable String speed) { | |
| 227 | + public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) { | |
| 228 | 228 | logger.info("playSpeed: "+streamId+", "+speed); |
| 229 | 229 | JSONObject json = new JSONObject(); |
| 230 | 230 | StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId); |
| ... | ... | @@ -233,6 +233,11 @@ public class PlaybackController { |
| 233 | 233 | logger.warn("streamId不存在!"); |
| 234 | 234 | return new ResponseEntity<String>(json.toString(), HttpStatus.BAD_REQUEST); |
| 235 | 235 | } |
| 236 | + if(speed != 0.25 && speed != 0.5 && speed != 1 && speed != 2.0 && speed != 4.0) { | |
| 237 | + json.put("msg", "不支持的speed(0.25 0.5 1、2、4)"); | |
| 238 | + logger.warn("不支持的speed: " + speed); | |
| 239 | + return new ResponseEntity<String>(json.toString(), HttpStatus.BAD_REQUEST); | |
| 240 | + } | |
| 236 | 241 | setCseq(streamId); |
| 237 | 242 | Device device = storager.queryVideoDevice(streamInfo.getDeviceID()); |
| 238 | 243 | cmder.playSpeedCmd(device, streamInfo, speed); | ... | ... |