优化云端录像转化
parent
daac0010b1
commit
16c056e338
|
@ -282,7 +282,7 @@ create table wvp_cloud_record (
|
||||||
collect bool default false,
|
collect bool default false,
|
||||||
reserve bool default false,
|
reserve bool default false,
|
||||||
file_size integer,
|
file_size integer,
|
||||||
time_len integer,
|
time_len float,
|
||||||
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
|
constraint uk_stream_push_app_stream_path unique (app, stream, file_path)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -80,15 +80,9 @@ public class MediaServerItem{
|
||||||
@Schema(description = "是否是默认ZLM")
|
@Schema(description = "是否是默认ZLM")
|
||||||
private boolean defaultServer;
|
private boolean defaultServer;
|
||||||
|
|
||||||
@Schema(description = "录像存储路径")
|
|
||||||
private String recordPath;
|
|
||||||
|
|
||||||
@Schema(description = "录像存储时长")
|
@Schema(description = "录像存储时长")
|
||||||
private int recordDate;
|
private int recordDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public MediaServerItem() {
|
public MediaServerItem() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,14 +300,6 @@ public class MediaServerItem{
|
||||||
this.sendRtpPortRange = sendRtpPortRange;
|
this.sendRtpPortRange = sendRtpPortRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRecordPath() {
|
|
||||||
return recordPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecordPath(String recordPath) {
|
|
||||||
this.recordPath = recordPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRecordDate() {
|
public int getRecordDate() {
|
||||||
return recordDate;
|
return recordDate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ public class OnRecordMp4HookParam extends HookParam{
|
||||||
private String url;
|
private String url;
|
||||||
private String vhost;
|
private String vhost;
|
||||||
private long start_time;
|
private long start_time;
|
||||||
private long time_len;
|
private double time_len;
|
||||||
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
|
@ -88,11 +88,11 @@ public class OnRecordMp4HookParam extends HookParam{
|
||||||
this.start_time = start_time;
|
this.start_time = start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTime_len() {
|
public double getTime_len() {
|
||||||
return time_len;
|
return time_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime_len(long time_len) {
|
public void setTime_len(double time_len) {
|
||||||
this.time_len = time_len;
|
this.time_len = time_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,14 +80,14 @@ public class CloudRecordItem {
|
||||||
CloudRecordItem cloudRecordItem = new CloudRecordItem();
|
CloudRecordItem cloudRecordItem = new CloudRecordItem();
|
||||||
cloudRecordItem.setApp(param.getApp());
|
cloudRecordItem.setApp(param.getApp());
|
||||||
cloudRecordItem.setStream(param.getStream());
|
cloudRecordItem.setStream(param.getStream());
|
||||||
cloudRecordItem.setStartTime(param.getStart_time());
|
cloudRecordItem.setStartTime(param.getStart_time()*1000);
|
||||||
cloudRecordItem.setFileName(param.getFile_name());
|
cloudRecordItem.setFileName(param.getFile_name());
|
||||||
cloudRecordItem.setFolder(param.getFolder());
|
cloudRecordItem.setFolder(param.getFolder());
|
||||||
cloudRecordItem.setFileSize(param.getFile_size());
|
cloudRecordItem.setFileSize(param.getFile_size());
|
||||||
cloudRecordItem.setFilePath(param.getFile_path());
|
cloudRecordItem.setFilePath(param.getFile_path());
|
||||||
cloudRecordItem.setMediaServerId(param.getMediaServerId());
|
cloudRecordItem.setMediaServerId(param.getMediaServerId());
|
||||||
cloudRecordItem.setTimeLen(param.getTime_len());
|
cloudRecordItem.setTimeLen((long) param.getTime_len() * 1000);
|
||||||
cloudRecordItem.setEndTime(param.getStart_time() + param.getTime_len());
|
cloudRecordItem.setEndTime((param.getStart_time() + (long)param.getTime_len()) * 1000);
|
||||||
return cloudRecordItem;
|
return cloudRecordItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -780,11 +780,12 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
} else {
|
} else {
|
||||||
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
||||||
String endTime = inviteInfo.getStreamInfo().getEndTime();
|
String endTime = inviteInfo.getStreamInfo().getEndTime();
|
||||||
|
// 此时start和end单位是秒
|
||||||
long start = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime);
|
long start = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime);
|
||||||
long end = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime);
|
long end = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime);
|
||||||
|
|
||||||
BigDecimal currentCount = new BigDecimal(duration);
|
BigDecimal currentCount = new BigDecimal(duration);
|
||||||
BigDecimal totalCount = new BigDecimal(end - start);
|
BigDecimal totalCount = new BigDecimal((end - start) * 1000);
|
||||||
BigDecimal divide = currentCount.divide(totalCount, 2, RoundingMode.HALF_UP);
|
BigDecimal divide = currentCount.divide(totalCount, 2, RoundingMode.HALF_UP);
|
||||||
double process = divide.doubleValue();
|
double process = divide.doubleValue();
|
||||||
inviteInfo.getStreamInfo().setProgress(process);
|
inviteInfo.getStreamInfo().setProgress(process);
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class DateUtil {
|
||||||
* 时间戳 转 yyyy_MM_dd
|
* 时间戳 转 yyyy_MM_dd
|
||||||
*/
|
*/
|
||||||
public static String timestampTo_yyyy_MM_dd(long timestamp) {
|
public static String timestampTo_yyyy_MM_dd(long timestamp) {
|
||||||
Instant instant = Instant.ofEpochSecond(timestamp);
|
Instant instant = Instant.ofEpochMilli(timestamp);
|
||||||
return DateFormatter.format(LocalDateTime.ofInstant(instant, ZoneId.of(zoneStr)));
|
return DateFormatter.format(LocalDateTime.ofInstant(instant, ZoneId.of(zoneStr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue