调整录像进度获取流程
parent
5a70a4742d
commit
bec35ebf94
|
@ -60,4 +60,6 @@ public interface IMediaNodeServerService {
|
||||||
void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout);
|
void startSendRtpPassive(MediaServer mediaServer, SendRtpItem sendRtpItem, Integer timeout);
|
||||||
|
|
||||||
void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem);
|
void startSendRtpStream(MediaServer mediaServer, SendRtpItem sendRtpItem);
|
||||||
|
|
||||||
|
Long updateDownloadProcess(MediaServer mediaServer, String app, String stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,4 +151,6 @@ public interface IMediaServerService {
|
||||||
String app, String stream, String channelId, boolean tcp, boolean rtcp);
|
String app, String stream, String channelId, boolean tcp, boolean rtcp);
|
||||||
|
|
||||||
MediaServer getMediaServerByAppAndStream(String app, String stream);
|
MediaServer getMediaServerByAppAndStream(String app, String stream);
|
||||||
|
|
||||||
|
Long updateDownloadProcess(MediaServer mediaServerItem, String app, String stream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,4 +921,14 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long updateDownloadProcess(MediaServer mediaServer, String app, String stream) {
|
||||||
|
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||||
|
if (mediaNodeServerService == null) {
|
||||||
|
logger.info("[updateDownloadProcess] 失败, mediaServer的类型: {},未找到对应的实现类", mediaServer.getType());
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到mediaServer对应的实现类");
|
||||||
|
}
|
||||||
|
return mediaNodeServerService.updateDownloadProcess(mediaServer, app, stream);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,4 +384,14 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||||
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
|
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long updateDownloadProcess(MediaServer mediaServer, String app, String stream) {
|
||||||
|
MediaInfo mediaInfo = getMediaInfo(mediaServer, app, stream);
|
||||||
|
if (mediaInfo == null) {
|
||||||
|
logger.warn("[获取下载进度] 查询进度失败, 节点Id: {}, {}/{}", mediaServer.getId(), app, stream);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mediaInfo.getDuration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1081,12 +1081,8 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String app = "rtp";
|
String app = "rtp";
|
||||||
MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, app, stream);
|
Long duration = mediaServerService.updateDownloadProcess(mediaServerItem, app, stream);
|
||||||
if (mediaInfo == null) {
|
if (duration == null || duration == 0) {
|
||||||
logger.warn("[获取下载进度] 查询进度失败, 节点Id: {}, {}/{}", mediaServerId, app, stream);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (mediaInfo.getDuration() == 0) {
|
|
||||||
inviteInfo.getStreamInfo().setProgress(0);
|
inviteInfo.getStreamInfo().setProgress(0);
|
||||||
} else {
|
} else {
|
||||||
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
||||||
|
@ -1095,7 +1091,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
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(mediaInfo.getDuration());
|
BigDecimal currentCount = new BigDecimal(duration);
|
||||||
BigDecimal totalCount = new BigDecimal((end - start) * 1000);
|
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();
|
||||||
|
|
Loading…
Reference in New Issue