临时提交
parent
5011a6b74a
commit
2c0c576d93
|
@ -12,10 +12,7 @@ import com.genersoft.iot.vmp.media.abl.event.HookAblServerKeepaliveEvent;
|
|||
import com.genersoft.iot.vmp.media.abl.event.HookAblServerStartEvent;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.bean.ResultForOnPublish;
|
||||
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.MediaNotFoundEvent;
|
||||
import com.genersoft.iot.vmp.media.event.media.MediaRtpServerTimeoutEvent;
|
||||
import com.genersoft.iot.vmp.media.event.media.*;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResult;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.HookResultForOnPublish;
|
||||
|
@ -177,17 +174,16 @@ public class ABLHttpHookListener {
|
|||
|
||||
logger.info("[ABL HOOK] 录像进度通知:{}->{}/{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream(), param.getCurrentFileDuration(), param.getTotalVideoDuration());
|
||||
|
||||
// TODO 这里用来做录像进度
|
||||
// MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId());
|
||||
// if (mediaServer == null) {
|
||||
// return new HookResultForOnPublish(0, "success");
|
||||
// }
|
||||
//
|
||||
// ResultForOnPublish resultForOnPublish = mediaService.authenticatePublish(mediaServer, param.getApp(), param.getStream(), param.getParams());
|
||||
// if (resultForOnPublish == null) {
|
||||
// logger.info("[ABL HOOK]推流鉴权 拒绝 响应:{}->{}", param.getMediaServerId(), param);
|
||||
// ablresTfulUtils.closeStreams(mediaServer, param.getApp(), param.getStream());
|
||||
// }
|
||||
try {
|
||||
MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId());
|
||||
if (mediaServerItem != null) {
|
||||
MediaRecordMp4Event event = MediaRecordMp4Event.getInstance(this, param, mediaServerItem);
|
||||
event.setMediaServer(mediaServerItem);
|
||||
applicationEventPublisher.publishEvent(event);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
logger.info("[ZLM-HOOK-rtpServer收流超时] 发送通知失败 ", e);
|
||||
}
|
||||
return HookResult.SUCCESS();
|
||||
}
|
||||
|
||||
|
@ -273,9 +269,8 @@ public class ABLHttpHookListener {
|
|||
@ResponseBody
|
||||
@PostMapping(value = "/on_stream_not_found", produces = "application/json;charset=UTF-8")
|
||||
public HookResult onStreamNotFound(@RequestBody ABLHookParam param) {
|
||||
|
||||
logger.info("[ABL HOOK] 流未找到:{}->{}/{}", param.getMediaServerId(), param.getApp(), param.getStream());
|
||||
|
||||
|
||||
MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId());
|
||||
if (!userSetting.isAutoApplyPlay() || mediaServer == null) {
|
||||
return HookResult.SUCCESS();
|
||||
|
@ -341,7 +336,6 @@ public class ABLHttpHookListener {
|
|||
@PostMapping(value = "/on_record_mp4", produces = "application/json;charset=UTF-8")
|
||||
public HookResult onRecordMp4(HttpServletRequest request, @RequestBody OnRecordMp4ABLHookParam param) {
|
||||
logger.info("[ABL HOOK] 录像完成事件:{}->{}", param.getMediaServerId(), param.getFileName());
|
||||
|
||||
// try {
|
||||
// MediaServer mediaServerItem = mediaServerService.getOne(param.getMediaServerId());
|
||||
// if (mediaServerItem != null) {
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||
import com.genersoft.iot.vmp.common.CommonCallback;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||
import com.genersoft.iot.vmp.media.abl.bean.AblServerConfig;
|
||||
import com.genersoft.iot.vmp.media.abl.bean.hook.OnStreamArriveABLHookParam;
|
||||
|
@ -34,9 +35,18 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService {
|
|||
@Autowired
|
||||
private SipConfig sipConfig;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Override
|
||||
public boolean initStopSendRtp(MediaServer mediaInfo, String app, String stream, String ssrc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int createRTPServer(MediaServer mediaServer, String stream, long ssrc, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode) {
|
||||
return ablresTfulUtils.openRtpServer(mediaServer, "rtp", stream, 96, port, tcpMode, disableAudio?1:0);
|
||||
Boolean recordSip = userSetting.getRecordSip();
|
||||
return ablresTfulUtils.openRtpServer(mediaServer, "rtp", stream, 96, port, tcpMode, disableAudio?1:0, recordSip);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -316,7 +316,7 @@ public class ABLRESTfulUtils {
|
|||
}
|
||||
|
||||
|
||||
public Integer openRtpServer(MediaServer mediaServer, String app, String stream, int payload, Integer port, Integer tcpMode, Integer disableAudio) {
|
||||
public Integer openRtpServer(MediaServer mediaServer, String app, String stream, int payload, Integer port, Integer tcpMode, Integer disableAudio, Boolean record) {
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("vhost", "_defaultVhost_");
|
||||
param.put("app", app);
|
||||
|
@ -331,6 +331,9 @@ public class ABLRESTfulUtils {
|
|||
if (disableAudio != null) {
|
||||
param.put("disableAudio", disableAudio);
|
||||
}
|
||||
if (record != null && record) {
|
||||
param.put("enable_mp4", 1);
|
||||
}
|
||||
|
||||
JSONObject jsonObject = sendPost(mediaServer, "openRtpServer", param, null);
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
|
|
|
@ -30,10 +30,10 @@ import com.genersoft.iot.vmp.service.IDeviceChannelService;
|
|||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.media.event.hook.HookSubscribe;
|
||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.service.*;
|
||||
import com.genersoft.iot.vmp.service.bean.*;
|
||||
import com.genersoft.iot.vmp.service.bean.DownloadFileInfo;
|
||||
import com.genersoft.iot.vmp.service.bean.ErrorCallback;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.CloudRecordUtils;
|
||||
|
@ -1084,12 +1084,13 @@ public class PlayServiceImpl implements IPlayService {
|
|||
return null;
|
||||
}
|
||||
String app = "rtp";
|
||||
|
||||
MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, app, stream);
|
||||
if (mediaInfo == null) {
|
||||
logger.warn("[获取下载进度] 查询进度失败, 节点Id: {}, {}/{}", mediaServerId, app, stream);
|
||||
return null;
|
||||
}
|
||||
if (mediaInfo.getDuration() == 0) {
|
||||
if (mediaInfo.getDuration() == null || mediaInfo.getDuration() == 0) {
|
||||
inviteInfo.getStreamInfo().setProgress(0);
|
||||
} else {
|
||||
String startTime = inviteInfo.getStreamInfo().getStartTime();
|
||||
|
|
Loading…
Reference in New Issue