Merge branch 'refs/heads/master' into dev/master-通道结构重构
# Conflicts: # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java # src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForCatalogProcessor.java # src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java # src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java # src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.javapull/1642/head
commit
e4c11bfebe
|
@ -87,6 +87,9 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||
@Schema(description = "产生源类型,包括 unknown = 0,rtmp_push=1,rtsp_push=2,rtp_push=3,pull=4,ffmpeg_pull=5,mp4_vod=6,device_chn=7")
|
||||
private int originType;
|
||||
|
||||
@Schema(description = "转码后的视频流")
|
||||
private StreamInfo transcodeStream;
|
||||
|
||||
public void setFlv(StreamURL flv) {
|
||||
this.flv = flv;
|
||||
}
|
||||
|
@ -533,6 +536,14 @@ public class StreamInfo implements Serializable, Cloneable{
|
|||
this.transactionInfo = transactionInfo;
|
||||
}
|
||||
|
||||
public StreamInfo getTranscodeStream() {
|
||||
return transcodeStream;
|
||||
}
|
||||
|
||||
public void setTranscodeStream(StreamInfo transcodeStream) {
|
||||
this.transcodeStream = transcodeStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamInfo clone() {
|
||||
StreamInfo instance = null;
|
||||
|
|
|
@ -21,7 +21,7 @@ public class UserSetting {
|
|||
|
||||
private Boolean seniorSdp = Boolean.FALSE;
|
||||
|
||||
private Integer playTimeout = 18000;
|
||||
private Integer playTimeout = 10000;
|
||||
|
||||
private int platformPlayTimeout = 20000;
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ import com.genersoft.iot.vmp.media.event.hook.HookType;
|
|||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxy;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.service.IStreamPushService;
|
||||
|
@ -593,12 +596,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
sendRtpItem.setPlayType(InviteStreamType.PUSH);
|
||||
if (streamPushItem != null) {
|
||||
// 从redis查询是否正在接收这个推流
|
||||
StreamPush pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
||||
OnStreamChangedHookParam pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
||||
if (pushListItem != null) {
|
||||
sendRtpItem.setServerId(pushListItem.getServerId());
|
||||
sendRtpItem.setServerId(pushListItem.getSeverId());
|
||||
sendRtpItem.setMediaServerId(pushListItem.getMediaServerId());
|
||||
|
||||
pushListItem.setSelf(userSetting.getServerId().equals(pushListItem.getServerId()));
|
||||
redisCatchStorage.updateSendRTPSever(sendRtpItem);
|
||||
// 开始推流
|
||||
sendPushStream(sendRtpItem, mediaServerItem, platform, request);
|
||||
|
|
|
@ -318,8 +318,8 @@ public class NotifyRequestForCatalogProcessor extends SIPRequestProcessorParent
|
|||
}
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 10000) //每1秒执行一次
|
||||
public void execute(){
|
||||
log.info("[待处理Notify-目录订阅消息数量]: {}", taskQueue.size());
|
||||
}
|
||||
// @Scheduled(fixedRate = 10000) //每1秒执行一次
|
||||
// public void execute(){
|
||||
// logger.info("[待处理Notify-目录订阅消息数量]: {}", taskQueue.size());
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -188,8 +188,8 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
|
|||
}
|
||||
taskQueue.clear();
|
||||
}
|
||||
@Scheduled(fixedRate = 10000)
|
||||
public void execute(){
|
||||
logger.info("[待处理Notify-移动位置订阅消息数量]: {}", taskQueue.size());
|
||||
}
|
||||
// @Scheduled(fixedRate = 10000)
|
||||
// public void execute(){
|
||||
// logger.debug("[待处理Notify-移动位置订阅消息数量]: {}", taskQueue.size());
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.media.event.media;
|
|||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
|
||||
/**
|
||||
* 流到来事件
|
||||
|
@ -19,7 +20,8 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
mediaArrivalEvent.setStream(hookParam.getStream());
|
||||
mediaArrivalEvent.setMediaServer(mediaServer);
|
||||
mediaArrivalEvent.setSchema(hookParam.getSchema());
|
||||
mediaArrivalEvent.setCallId(hookParam.getCallId());
|
||||
mediaArrivalEvent.setSchema(hookParam.getSchema());
|
||||
mediaArrivalEvent.setHookParam(hookParam);
|
||||
return mediaArrivalEvent;
|
||||
}
|
||||
|
||||
|
@ -27,6 +29,10 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
|
||||
private String callId;
|
||||
|
||||
private OnStreamChangedHookParam hookParam;
|
||||
|
||||
private StreamContent streamInfo;
|
||||
|
||||
public MediaInfo getMediaInfo() {
|
||||
return mediaInfo;
|
||||
}
|
||||
|
@ -43,4 +49,20 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
public void setCallId(String callId) {
|
||||
this.callId = callId;
|
||||
}
|
||||
|
||||
public OnStreamChangedHookParam getHookParam() {
|
||||
return hookParam;
|
||||
}
|
||||
|
||||
public void setHookParam(OnStreamChangedHookParam hookParam) {
|
||||
this.hookParam = hookParam;
|
||||
}
|
||||
|
||||
public StreamContent getStreamInfo() {
|
||||
return streamInfo;
|
||||
}
|
||||
|
||||
public void setStreamInfo(StreamContent streamInfo) {
|
||||
this.streamInfo = streamInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -809,6 +809,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
streamInfoResult.setRtc(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam, isPlay);
|
||||
|
||||
streamInfoResult.setMediaInfo(mediaInfo);
|
||||
|
||||
if (!"broadcast".equalsIgnoreCase(app) && !ObjectUtils.isEmpty(mediaServer.getTranscodeSuffix()) && !"null".equalsIgnoreCase(mediaServer.getTranscodeSuffix())) {
|
||||
String newStream = stream + "_" + mediaServer.getTranscodeSuffix();
|
||||
mediaServer.setTranscodeSuffix(null);
|
||||
StreamInfo transcodeStreamInfo = getStreamInfoByAppAndStream(mediaServer, app, newStream, null, addr, callId, isPlay);
|
||||
streamInfoResult.setTranscodeStream(transcodeStreamInfo);
|
||||
}
|
||||
return streamInfoResult;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -120,9 +121,13 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
|||
streamPushMapper.update(transform);
|
||||
gbStreamMapper.updateMediaServer(event.getApp(), event.getStream(), event.getMediaServer().getId());
|
||||
}
|
||||
|
||||
// 冗余数据,自己系统中自用
|
||||
redisCatchStorage.addPushListItem(event.getApp(), event.getStream(), event);
|
||||
if (!"broadcast".equals(event.getApp()) && !"talk".equals(event.getApp())) {
|
||||
StreamInfo streamInfo = mediaServerService.getStreamInfoByAppAndStream(
|
||||
event.getMediaServer(), event.getApp(), event.getStream(), event.getMediaInfo(), event.getCallId());
|
||||
event.getHookParam().setStreamInfo(new StreamContent(streamInfo));
|
||||
redisCatchStorage.addPushListItem(event.getApp(), event.getStream(), event);
|
||||
}
|
||||
|
||||
// 发送流变化redis消息
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
|||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo;
|
||||
|
@ -216,7 +217,7 @@ public interface IRedisCatchStorage {
|
|||
|
||||
void addPushListItem(String app, String stream, MediaArrivalEvent param);
|
||||
|
||||
StreamPush getPushListItem(String app, String stream);
|
||||
OnStreamChangedHookParam getPushListItem(String app, String stream);
|
||||
|
||||
void removePushListItem(String app, String stream, String mediaServerId);
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public interface CloudRecordServiceMapper {
|
|||
" <if test= 'ids != null ' > and id in " +
|
||||
" <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" +
|
||||
" </if>" +
|
||||
" order by start_time DESC" +
|
||||
" order by start_time ASC" +
|
||||
" </script>")
|
||||
List<CloudRecordItem> getList(@Param("query") String query, @Param("app") String app, @Param("stream") String stream,
|
||||
@Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp,
|
||||
|
|
|
@ -5,15 +5,13 @@ import com.alibaba.fastjson2.JSONObject;
|
|||
import com.genersoft.iot.vmp.common.SystemAllInfo;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.AlarmChannelMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaInfo;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamPush;
|
||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||
|
@ -698,14 +696,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
|||
@Override
|
||||
public void addPushListItem(String app, String stream, MediaArrivalEvent event) {
|
||||
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
||||
StreamPush streamPushItem = StreamPush.getInstance(event, userSetting.getServerId());
|
||||
redisTemplate.opsForValue().set(key, streamPushItem);
|
||||
redisTemplate.opsForValue().set(key, event.getHookParam());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamPush getPushListItem(String app, String stream) {
|
||||
public OnStreamChangedHookParam getPushListItem(String app, String stream) {
|
||||
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
||||
return (StreamPush)redisTemplate.opsForValue().get(key);
|
||||
return (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -98,6 +98,9 @@ public class StreamContent {
|
|||
@Schema(description = "文件下载地址(录像下载使用)")
|
||||
private DownloadFileInfo downLoadFilePath;
|
||||
|
||||
@Schema(description = "转码后的视频流")
|
||||
private StreamContent transcodeStream;
|
||||
|
||||
private double progress;
|
||||
|
||||
public StreamContent(StreamInfo streamInfo) {
|
||||
|
@ -179,6 +182,17 @@ public class StreamContent {
|
|||
if (streamInfo.getDownLoadFilePath() != null) {
|
||||
this.downLoadFilePath = streamInfo.getDownLoadFilePath();
|
||||
}
|
||||
if (streamInfo.getTranscodeStream() != null) {
|
||||
this.transcodeStream = new StreamContent(streamInfo.getTranscodeStream());
|
||||
}
|
||||
}
|
||||
|
||||
public StreamContent getTranscodeStream() {
|
||||
return transcodeStream;
|
||||
}
|
||||
|
||||
public void setTranscodeStream(StreamContent transcodeStream) {
|
||||
this.transcodeStream = transcodeStream;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
|
|
|
@ -126,13 +126,32 @@ public class ApiStreamController {
|
|||
resultJjson.put("ChannelID", code);
|
||||
resultJjson.put("ChannelName", deviceChannel.getName());
|
||||
resultJjson.put("ChannelCustomName", "");
|
||||
resultJjson.put("FLV", streamInfo.getFlv().getUrl());
|
||||
if(streamInfo.getHttps_flv() != null) {
|
||||
resultJjson.put("HTTPS_FLV", streamInfo.getHttps_flv().getUrl());
|
||||
if (streamInfo.getTranscodeStream() != null) {
|
||||
resultJjson.put("FLV", streamInfo.getTranscodeStream().getFlv().getUrl());
|
||||
}else {
|
||||
resultJjson.put("FLV", streamInfo.getFlv().getUrl());
|
||||
|
||||
}
|
||||
resultJjson.put("WS_FLV", streamInfo.getWs_flv().getUrl());
|
||||
if(streamInfo.getHttps_flv() != null) {
|
||||
if (streamInfo.getTranscodeStream() != null) {
|
||||
resultJjson.put("HTTPS_FLV", streamInfo.getTranscodeStream().getHttps_flv().getUrl());
|
||||
}else {
|
||||
resultJjson.put("HTTPS_FLV", streamInfo.getHttps_flv().getUrl());
|
||||
}
|
||||
}
|
||||
|
||||
if (streamInfo.getTranscodeStream() != null) {
|
||||
resultJjson.put("WS_FLV", streamInfo.getTranscodeStream().getWs_flv().getUrl());
|
||||
}else {
|
||||
resultJjson.put("WS_FLV", streamInfo.getWs_flv().getUrl());
|
||||
}
|
||||
|
||||
if(streamInfo.getWss_flv() != null) {
|
||||
resultJjson.put("WSS_FLV", streamInfo.getWss_flv().getUrl());
|
||||
if (streamInfo.getTranscodeStream() != null) {
|
||||
resultJjson.put("WSS_FLV", streamInfo.getTranscodeStream().getWss_flv().getUrl());
|
||||
}else {
|
||||
resultJjson.put("WSS_FLV", streamInfo.getWss_flv().getUrl());
|
||||
}
|
||||
}
|
||||
resultJjson.put("RTMP", streamInfo.getRtmp().getUrl());
|
||||
if (streamInfo.getRtmps() != null) {
|
||||
|
|
|
@ -473,10 +473,14 @@ export default {
|
|||
},
|
||||
getUrlByStreamInfo() {
|
||||
console.log(this.streamInfo)
|
||||
let streamInfo = this.streamInfo
|
||||
if (this.streamInfo.transcodeStream) {
|
||||
streamInfo = this.streamInfo.transcodeStream;
|
||||
}
|
||||
if (location.protocol === "https:") {
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]]
|
||||
this.videoUrl = streamInfo[this.player[this.activePlayer][1]]
|
||||
} else {
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][0]]
|
||||
this.videoUrl = streamInfo[this.player[this.activePlayer][0]]
|
||||
}
|
||||
return this.videoUrl;
|
||||
|
||||
|
|
Loading…
Reference in New Issue