修复云端录像seek不准确的问题

This commit is contained in:
lin
2025-04-14 12:43:05 +08:00
parent 59c6243338
commit f2e3016a48
15 changed files with 41 additions and 24 deletions

View File

@@ -72,7 +72,7 @@ public interface IMediaNodeServerService {
void loadMP4File(MediaServer mediaServer, String app, String stream, String datePath); void loadMP4File(MediaServer mediaServer, String app, String stream, String datePath);
void seekRecordStamp(MediaServer mediaServer, String app, String stream, int stamp); void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp);
void setRecordSpeed(MediaServer mediaServer, String app, String stream, Integer speed); void setRecordSpeed(MediaServer mediaServer, String app, String stream, Integer speed);
} }

View File

@@ -162,7 +162,7 @@ public interface IMediaServerService {
StreamInfo loadMP4File(MediaServer mediaServer, String app, String stream, String datePath); StreamInfo loadMP4File(MediaServer mediaServer, String app, String stream, String datePath);
void seekRecordStamp(MediaServer mediaServer, String app, String stream, int stamp); void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp);
void setRecordSpeed(MediaServer mediaServer, String app, String stream, Integer speed); void setRecordSpeed(MediaServer mediaServer, String app, String stream, Integer speed);
} }

View File

@@ -983,7 +983,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
} }
@Override @Override
public void seekRecordStamp(MediaServer mediaServer, String app, String stream, int stamp) { public void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp) {
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType()); IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
if (mediaNodeServerService == null) { if (mediaNodeServerService == null) {
log.info("[seekRecordStamp] 失败, mediaServer的类型 {},未找到对应的实现类", mediaServer.getType()); log.info("[seekRecordStamp] 失败, mediaServer的类型 {},未找到对应的实现类", mediaServer.getType());

View File

@@ -562,7 +562,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
} }
@Override @Override
public void seekRecordStamp(MediaServer mediaServer, String app, String stream, int stamp) { public void seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp) {
JSONObject jsonObject = zlmresTfulUtils.seekRecordStamp(mediaServer, app, stream, stamp, "ts"); JSONObject jsonObject = zlmresTfulUtils.seekRecordStamp(mediaServer, app, stream, stamp, "ts");
if (jsonObject == null) { if (jsonObject == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "请求失败"); throw new ControllerException(ErrorCode.ERROR100.getCode(), "请求失败");

View File

@@ -438,7 +438,7 @@ public class ZLMRESTfulUtils {
return sendPost(mediaServer, "setRecordSpeed",param, null); return sendPost(mediaServer, "setRecordSpeed",param, null);
} }
public JSONObject seekRecordStamp(MediaServer mediaServer, String app, String stream, long stamp, String schema) { public JSONObject seekRecordStamp(MediaServer mediaServer, String app, String stream, Double stamp, String schema) {
Map<String, Object> param = new HashMap<>(1); Map<String, Object> param = new HashMap<>(1);
param.put("vhost", "__defaultVhost__"); param.put("vhost", "__defaultVhost__");
param.put("app", app); param.put("app", app);

View File

@@ -60,7 +60,7 @@ public interface ICloudRecordService {
*/ */
void loadRecord(String app, String stream, String date, ErrorCallback<StreamInfo> callback); void loadRecord(String app, String stream, String date, ErrorCallback<StreamInfo> callback);
void seekRecord(String mediaServerId,String app, String stream, Integer seek); void seekRecord(String mediaServerId,String app, String stream, Double seek);
void setRecordSpeed(String mediaServerId, String app, String stream, Integer speed); void setRecordSpeed(String mediaServerId, String app, String stream, Integer speed);

View File

@@ -79,7 +79,7 @@ public class CloudRecordItem {
/** /**
* 文件时长 * 文件时长
*/ */
private long timeLen; private double timeLen;
/** /**
* 所属服务ID * 所属服务ID
@@ -96,7 +96,7 @@ public class CloudRecordItem {
cloudRecordItem.setFileSize(param.getRecordInfo().getFileSize()); cloudRecordItem.setFileSize(param.getRecordInfo().getFileSize());
cloudRecordItem.setFilePath(param.getRecordInfo().getFilePath()); cloudRecordItem.setFilePath(param.getRecordInfo().getFilePath());
cloudRecordItem.setMediaServerId(param.getMediaServer().getId()); cloudRecordItem.setMediaServerId(param.getMediaServer().getId());
cloudRecordItem.setTimeLen((long) param.getRecordInfo().getTimeLen() * 1000); cloudRecordItem.setTimeLen(param.getRecordInfo().getTimeLen() * 1000);
cloudRecordItem.setEndTime((param.getRecordInfo().getStartTime() + (long)param.getRecordInfo().getTimeLen()) * 1000); cloudRecordItem.setEndTime((param.getRecordInfo().getStartTime() + (long)param.getRecordInfo().getTimeLen()) * 1000);
Map<String, String> paramsMap = MediaServerUtils.urlParamToMap(param.getRecordInfo().getParams()); Map<String, String> paramsMap = MediaServerUtils.urlParamToMap(param.getRecordInfo().getParams());
if (paramsMap.get("callId") != null) { if (paramsMap.get("callId") != null) {

View File

@@ -321,7 +321,7 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
} }
@Override @Override
public void seekRecord(String mediaServerId,String app, String stream, Integer seek) { public void seekRecord(String mediaServerId,String app, String stream, Double seek) {
MediaServer mediaServer = mediaServerService.getOne(mediaServerId); MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
if (mediaServer == null) { if (mediaServer == null) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "媒体节点不存在: " + mediaServerId); throw new ControllerException(ErrorCode.ERROR100.getCode(), "媒体节点不存在: " + mediaServerId);

View File

@@ -317,7 +317,7 @@ public class CloudRecordController {
@RequestParam(required = true) String mediaServerId, @RequestParam(required = true) String mediaServerId,
@RequestParam(required = true) String app, @RequestParam(required = true) String app,
@RequestParam(required = true) String stream, @RequestParam(required = true) String stream,
@RequestParam(required = true) Integer seek @RequestParam(required = true) Double seek
) { ) {
cloudRecordService.seekRecord(mediaServerId, app, stream, seek); cloudRecordService.seekRecord(mediaServerId, app, stream, seek);

View File

@@ -365,7 +365,7 @@ create table IF NOT EXISTS wvp_cloud_record
file_path character varying(500), file_path character varying(500),
collect bool default false, collect bool default false,
file_size bigint, file_size bigint,
time_len bigint time_len double precision
); );
drop table IF EXISTS wvp_user; drop table IF EXISTS wvp_user;

View File

@@ -366,7 +366,7 @@ create table IF NOT EXISTS wvp_cloud_record
file_path character varying(500), file_path character varying(500),
collect bool default false, collect bool default false,
file_size int8, file_size int8,
time_len int8 time_len double precision
); );
drop table IF EXISTS wvp_user; drop table IF EXISTS wvp_user;

View File

@@ -426,3 +426,7 @@ call wvp_20250111();
DROP PROCEDURE wvp_20250111; DROP PROCEDURE wvp_20250111;
DELIMITER ; DELIMITER ;
/**
* 20250414
*/
alter table wvp_cloud_record modify time_len double precision;

View File

@@ -294,5 +294,10 @@ call wvp_20250402();
DROP PROCEDURE wvp_20250402; DROP PROCEDURE wvp_20250402;
DELIMITER ; DELIMITER ;
/**
* 20250414
*/
alter table wvp_cloud_record modify time_len double precision;

View File

@@ -388,3 +388,7 @@ alter table wvp_cloud_record alter folder type varchar(500);
alter table wvp_cloud_record alter file_path type varchar(500); alter table wvp_cloud_record alter file_path type varchar(500);
update wvp_cloud_record set server_id = '你的服务ID'; update wvp_cloud_record set server_id = '你的服务ID';
/**
* 20250414
*/
alter table wvp_cloud_record modify time_len double precision;

View File

@@ -112,4 +112,8 @@ update wvp_record_plan_item set start = start * 30, stop = (stop + 1) * 30
create index if not exists data_type on wvp_device_channel (data_type); create index if not exists data_type on wvp_device_channel (data_type);
create index if not exists data_device_id on wvp_device_channel (data_device_id); create index if not exists data_device_id on wvp_device_channel (data_device_id);
/**
* 20250414
*/
alter table wvp_cloud_record modify time_len double precision;