Commit 16c056e338b7d2006da05f1f70bf87624f458d3d

Authored by 648540858
1 parent daac0010

优化云端录像转化

sql/初始化.sql
... ... @@ -282,7 +282,7 @@ create table wvp_cloud_record (
282 282 collect bool default false,
283 283 reserve bool default false,
284 284 file_size integer,
285   - time_len integer,
  285 + time_len float,
286 286 constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
287 287 );
288 288  
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/MediaServerItem.java
... ... @@ -80,15 +80,9 @@ public class MediaServerItem{
80 80 @Schema(description = "是否是默认ZLM")
81 81 private boolean defaultServer;
82 82  
83   - @Schema(description = "录像存储路径")
84   - private String recordPath;
85   -
86 83 @Schema(description = "录像存储时长")
87 84 private int recordDate;
88 85  
89   -
90   -
91   -
92 86 public MediaServerItem() {
93 87 }
94 88  
... ... @@ -306,14 +300,6 @@ public class MediaServerItem{
306 300 this.sendRtpPortRange = sendRtpPortRange;
307 301 }
308 302  
309   - public String getRecordPath() {
310   - return recordPath;
311   - }
312   -
313   - public void setRecordPath(String recordPath) {
314   - this.recordPath = recordPath;
315   - }
316   -
317 303 public int getRecordDate() {
318 304 return recordDate;
319 305 }
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/OnRecordMp4HookParam.java
... ... @@ -14,7 +14,7 @@ public class OnRecordMp4HookParam extends HookParam{
14 14 private String url;
15 15 private String vhost;
16 16 private long start_time;
17   - private long time_len;
  17 + private double time_len;
18 18  
19 19 public String getApp() {
20 20 return app;
... ... @@ -88,11 +88,11 @@ public class OnRecordMp4HookParam extends HookParam{
88 88 this.start_time = start_time;
89 89 }
90 90  
91   - public long getTime_len() {
  91 + public double getTime_len() {
92 92 return time_len;
93 93 }
94 94  
95   - public void setTime_len(long time_len) {
  95 + public void setTime_len(double time_len) {
96 96 this.time_len = time_len;
97 97 }
98 98  
... ...
src/main/java/com/genersoft/iot/vmp/service/bean/CloudRecordItem.java
... ... @@ -80,14 +80,14 @@ public class CloudRecordItem {
80 80 CloudRecordItem cloudRecordItem = new CloudRecordItem();
81 81 cloudRecordItem.setApp(param.getApp());
82 82 cloudRecordItem.setStream(param.getStream());
83   - cloudRecordItem.setStartTime(param.getStart_time());
  83 + cloudRecordItem.setStartTime(param.getStart_time()*1000);
84 84 cloudRecordItem.setFileName(param.getFile_name());
85 85 cloudRecordItem.setFolder(param.getFolder());
86 86 cloudRecordItem.setFileSize(param.getFile_size());
87 87 cloudRecordItem.setFilePath(param.getFile_path());
88 88 cloudRecordItem.setMediaServerId(param.getMediaServerId());
89   - cloudRecordItem.setTimeLen(param.getTime_len());
90   - cloudRecordItem.setEndTime(param.getStart_time() + param.getTime_len());
  89 + cloudRecordItem.setTimeLen((long) param.getTime_len() * 1000);
  90 + cloudRecordItem.setEndTime((param.getStart_time() + (long)param.getTime_len()) * 1000);
91 91 return cloudRecordItem;
92 92 }
93 93  
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
... ... @@ -780,11 +780,12 @@ public class PlayServiceImpl implements IPlayService {
780 780 } else {
781 781 String startTime = inviteInfo.getStreamInfo().getStartTime();
782 782 String endTime = inviteInfo.getStreamInfo().getEndTime();
  783 + // 此时start和end单位是秒
783 784 long start = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime);
784 785 long end = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime);
785 786  
786 787 BigDecimal currentCount = new BigDecimal(duration);
787   - BigDecimal totalCount = new BigDecimal(end - start);
  788 + BigDecimal totalCount = new BigDecimal((end - start) * 1000);
788 789 BigDecimal divide = currentCount.divide(totalCount, 2, RoundingMode.HALF_UP);
789 790 double process = divide.doubleValue();
790 791 inviteInfo.getStreamInfo().setProgress(process);
... ...
src/main/java/com/genersoft/iot/vmp/utils/DateUtil.java
... ... @@ -89,7 +89,7 @@ public class DateUtil {
89 89 * 时间戳 转 yyyy_MM_dd
90 90 */
91 91 public static String timestampTo_yyyy_MM_dd(long timestamp) {
92   - Instant instant = Instant.ofEpochSecond(timestamp);
  92 + Instant instant = Instant.ofEpochMilli(timestamp);
93 93 return DateFormatter.format(LocalDateTime.ofInstant(instant, ZoneId.of(zoneStr)));
94 94 }
95 95  
... ...