优化短的录像文件的下载
parent
875285418b
commit
614ff4c71e
|
@ -4,7 +4,6 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -83,6 +82,8 @@ public class StreamInfo implements Serializable, Cloneable{
|
||||||
private double progress;
|
private double progress;
|
||||||
@Schema(description = "文件下载地址(录像下载使用)")
|
@Schema(description = "文件下载地址(录像下载使用)")
|
||||||
private DownloadFileInfo downLoadFilePath;
|
private DownloadFileInfo downLoadFilePath;
|
||||||
|
@Schema(description = "点播请求的callId")
|
||||||
|
private String callId;
|
||||||
|
|
||||||
@Schema(description = "是否暂停(录像回放使用)")
|
@Schema(description = "是否暂停(录像回放使用)")
|
||||||
private boolean pause;
|
private boolean pause;
|
||||||
|
@ -660,4 +661,12 @@ public class StreamInfo implements Serializable, Cloneable{
|
||||||
public void setServerId(String serverId) {
|
public void setServerId(String serverId) {
|
||||||
this.serverId = serverId;
|
this.serverId = serverId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCallId() {
|
||||||
|
return callId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCallId(String callId) {
|
||||||
|
this.callId = callId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||||
import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
|
import com.genersoft.iot.vmp.media.event.media.MediaDepartureEvent;
|
||||||
import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent;
|
import com.genersoft.iot.vmp.media.event.media.MediaNotFoundEvent;
|
||||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||||
|
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||||
import com.genersoft.iot.vmp.service.IReceiveRtpServerService;
|
import com.genersoft.iot.vmp.service.IReceiveRtpServerService;
|
||||||
import com.genersoft.iot.vmp.service.ISendRtpServerService;
|
import com.genersoft.iot.vmp.service.ISendRtpServerService;
|
||||||
import com.genersoft.iot.vmp.service.bean.*;
|
import com.genersoft.iot.vmp.service.bean.*;
|
||||||
|
@ -121,6 +122,9 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IReceiveRtpServerService receiveRtpServerService;
|
private IReceiveRtpServerService receiveRtpServerService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICloudRecordService cloudRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流到来的处理
|
* 流到来的处理
|
||||||
*/
|
*/
|
||||||
|
@ -1053,8 +1057,40 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
@Override
|
@Override
|
||||||
public StreamInfo getDownLoadInfo(Device device, DeviceChannel channel, String stream) {
|
public StreamInfo getDownLoadInfo(Device device, DeviceChannel channel, String stream) {
|
||||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, channel.getId(), stream);
|
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, channel.getId(), stream);
|
||||||
|
if (inviteInfo == null) {
|
||||||
|
String app = "rtp";
|
||||||
|
StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(app, stream);
|
||||||
|
if (streamAuthorityInfo != null) {
|
||||||
|
List<CloudRecordItem> allList = cloudRecordService.getAllList(null, app, stream, null, null, null, streamAuthorityInfo.getCallId(), null);
|
||||||
|
if (allList.isEmpty()) {
|
||||||
|
log.warn("[获取下载进度] 未查询到录像下载的信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String filePath = allList.get(0).getFilePath();
|
||||||
|
if (filePath == null) {
|
||||||
|
log.warn("[获取下载进度] 未查询到录像下载的文件路径 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String mediaServerId = allList.get(0).getMediaServerId();
|
||||||
|
MediaServer mediaServer = mediaServerService.getOne(mediaServerId);
|
||||||
|
if (mediaServer == null) {
|
||||||
|
log.warn("[获取下载进度] 未查询到录像下载的节点信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.warn("[获取下载进度] 发现下载已经结束,直接从数据库获取到文件 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream);
|
||||||
|
DownloadFileInfo downloadFileInfo = CloudRecordUtils.getDownloadFilePath(mediaServer, filePath);
|
||||||
|
StreamInfo streamInfo = new StreamInfo();
|
||||||
|
streamInfo.setDownLoadFilePath(downloadFileInfo);
|
||||||
|
streamInfo.setApp(app);
|
||||||
|
streamInfo.setStream(stream);
|
||||||
|
streamInfo.setServerId(mediaServerId);
|
||||||
|
streamInfo.setProgress(1.0);
|
||||||
|
return streamInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (inviteInfo == null || inviteInfo.getStreamInfo() == null) {
|
if (inviteInfo == null || inviteInfo.getStreamInfo() == null) {
|
||||||
log.warn("[获取下载进度] 未查询到录像下载的信息");
|
log.warn("[获取下载进度] 未查询到录像下载的信息 {}/{}-{}", device.getDeviceId(), channel.getDeviceId(), stream);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -355,24 +355,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// if (!changedStreamPushList.isEmpty()) {
|
|
||||||
// String type = "PUSH";
|
|
||||||
// int runLimit = 300;
|
|
||||||
// if (changedStreamPushList.size() > runLimit) {
|
|
||||||
// for (int i = 0; i < changedStreamPushList.size(); i += runLimit) {
|
|
||||||
// int toIndex = i + runLimit;
|
|
||||||
// if (i + runLimit > changedStreamPushList.size()) {
|
|
||||||
// toIndex = changedStreamPushList.size();
|
|
||||||
// }
|
|
||||||
// List<StreamPush> streamPushItemsSub = changedStreamPushList.subList(i, toIndex);
|
|
||||||
// streamPushMapper.delAll(streamPushItemsSub);
|
|
||||||
// }
|
|
||||||
// }else {
|
|
||||||
// streamPushMapper.delAll(changedStreamPushList);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
Collection<MediaInfo> mediaInfos = streamInfoPushItemMap.values();
|
Collection<MediaInfo> mediaInfos = streamInfoPushItemMap.values();
|
||||||
if (!mediaInfos.isEmpty()) {
|
if (!mediaInfos.isEmpty()) {
|
||||||
String type = "PUSH";
|
String type = "PUSH";
|
||||||
|
|
|
@ -85,6 +85,7 @@ export default {
|
||||||
}else {
|
}else {
|
||||||
this.downloadFile = this.streamInfo.downLoadFilePath.httpPath;
|
this.downloadFile = this.streamInfo.downLoadFilePath.httpPath;
|
||||||
}
|
}
|
||||||
|
this.percentage = 100
|
||||||
this.getProgressRun = false;
|
this.getProgressRun = false;
|
||||||
this.downloadFileClientEvent()
|
this.downloadFileClientEvent()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue