修复拉流代理无人观看自动停用失败
parent
733a11f265
commit
457c5e3821
|
@ -56,7 +56,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
|||
private SipSubscribe sipSubscribe;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private SipLayer sipLayer;
|
||||
|
@ -820,7 +820,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
|||
MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
||||
if (mediaServerItem != null) {
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
||||
ZLMServerFactory.closeRtpServer(mediaServerItem, sendRtpItem.getStreamId());
|
||||
zlmServerFactory.closeRtpServer(mediaServerItem, sendRtpItem.getStreamId());
|
||||
}
|
||||
SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(parentPlatform, sendRtpItem);
|
||||
if (byeRequest == null) {
|
||||
|
|
|
@ -67,7 +67,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
private IVideoManagerStorage storager;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private ZlmHttpHookSubscribe hookSubscribe;
|
||||
|
@ -140,7 +140,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, jsonObject, param, callIdHeader);
|
||||
});
|
||||
}else {
|
||||
JSONObject startSendRtpStreamResult = ZLMServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
JSONObject startSendRtpStreamResult = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
if (startSendRtpStreamResult != null) {
|
||||
startSendRtpStreamHand(evt, sendRtpItem, parentPlatform, startSendRtpStreamResult, param, callIdHeader);
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
private IVideoManagerStorage storager;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private SSRCFactory ssrcFactory;
|
||||
|
@ -115,7 +115,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),
|
||||
callIdHeader.getCallId(), null);
|
||||
ZLMServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
zlmServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) {
|
||||
ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
|
||||
if (platform != null) {
|
||||
|
@ -129,7 +129,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
|||
}
|
||||
}
|
||||
|
||||
int totalReaderCount = ZLMServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId);
|
||||
int totalReaderCount = zlmServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId);
|
||||
if (totalReaderCount <= 0) {
|
||||
logger.info("[收到bye] {} 无其它观看者,通知设备停止推流", streamId);
|
||||
if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) {
|
||||
|
|
|
@ -91,7 +91,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
private SIPSender sipSender;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
@ -345,7 +345,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
streamTypeStr = "UDP";
|
||||
}
|
||||
logger.info("[上级Invite] {}, 平台:{}, 通道:{}, 收流地址:{}:{},收流方式:{}, ssrc:{}", sessionName, username, channelId, addressStr, port, streamTypeStr, ssrc);
|
||||
SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||
|
||||
if (tcpActive != null) {
|
||||
|
@ -548,10 +548,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
CallIdHeader callIdHeader, MediaServerItem mediaServerItem,
|
||||
int port, Boolean tcpActive, boolean mediaTransmissionTCP,
|
||||
String channelId, String addressStr, String ssrc, String requesterId) {
|
||||
Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
// 自平台内容
|
||||
SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||
|
||||
if (sendRtpItem == null) {
|
||||
|
@ -587,10 +587,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
String channelId, String addressStr, String ssrc, String requesterId) {
|
||||
// 推流
|
||||
if (streamPushItem.isSelf()) {
|
||||
Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
// 自平台内容
|
||||
SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
|
||||
gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||
|
||||
if (sendRtpItem == null) {
|
||||
|
@ -706,7 +706,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
|||
mediaListManager.addChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream(), (app, stream, serverId) -> {
|
||||
dynamicTask.stop(callIdHeader.getCallId());
|
||||
if (serverId.equals(userSetting.getServerId())) {
|
||||
SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
|
||||
app, stream, channelId, mediaTransmissionTCP, platform.isRtcp());
|
||||
|
||||
if (sendRtpItem == null) {
|
||||
|
|
|
@ -506,7 +506,7 @@ public class ZLMHttpHookListener {
|
|||
// 拉流代理
|
||||
StreamProxyItem streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(param.getApp(), param.getStream());
|
||||
if (streamProxyItem != null) {
|
||||
if (streamProxyItem.isEnableDisableNoneReader()) {
|
||||
if (streamProxyItem.isEnableRemoveNoneReader()) {
|
||||
// 无人观看自动移除
|
||||
ret.put("close", true);
|
||||
streamProxyService.del(param.getApp(), param.getStream());
|
||||
|
|
|
@ -61,7 +61,7 @@ public class ZLMMediaListManager {
|
|||
private UserSetting userSetting;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
@ -97,7 +97,7 @@ public class ZLMMediaListManager {
|
|||
public void sendStreamEvent(String app, String stream, String mediaServerId) {
|
||||
MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
|
||||
// 查看推流状态
|
||||
Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, app, stream);
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, app, stream);
|
||||
if (streamReady != null && streamReady) {
|
||||
ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream);
|
||||
if (channelOnlineEventLister != null) {
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private EventPublisher publisher;
|
||||
|
@ -181,7 +181,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
int rtpServerPort;
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
rtpServerPort = ZLMServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port, reUsePort, tcpMode);
|
||||
rtpServerPort = zlmServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port, reUsePort, tcpMode);
|
||||
} else {
|
||||
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
if (mediaServerItem == null) {
|
||||
return;
|
||||
}
|
||||
ZLMServerFactory.closeRtpServer(mediaServerItem, streamId);
|
||||
zlmServerFactory.closeRtpServer(mediaServerItem, streamId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -202,7 +202,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
callback.run(false);
|
||||
return;
|
||||
}
|
||||
ZLMServerFactory.closeRtpServer(mediaServerItem, streamId, callback);
|
||||
zlmServerFactory.closeRtpServer(mediaServerItem, streamId, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -213,7 +213,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
|
||||
@Override
|
||||
public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) {
|
||||
return ZLMServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
|
||||
return zlmServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
private DynamicTask dynamicTask;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private SubscribeHolder subscribeHolder;
|
||||
|
@ -338,7 +338,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
param.put("vhost", "__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStreamId());
|
||||
ZLMServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
zlmServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
private ZLMRESTfulUtils zlmresTfulUtils;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private AssistRESTfulUtils assistRESTfulUtils;
|
||||
|
@ -142,7 +142,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
String mediaServerId = streamInfo.getMediaServerId();
|
||||
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
|
||||
|
||||
Boolean ready = ZLMServerFactory.isStreamReady(mediaInfo, "rtp", streamId);
|
||||
Boolean ready = zlmServerFactory.isStreamReady(mediaInfo, "rtp", streamId);
|
||||
if (ready != null && ready) {
|
||||
callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
|
||||
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
|
||||
|
|
|
@ -72,7 +72,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
@ -230,7 +230,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||
param.put("pt", requestPushStreamMsg.getPt());
|
||||
param.put("use_ps", requestPushStreamMsg.isPs() ? "1" : "0");
|
||||
param.put("only_audio", requestPushStreamMsg.isOnlyAudio() ? "1" : "0");
|
||||
JSONObject jsonObject = ZLMServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaInfo, param);
|
||||
// 回复消息
|
||||
responsePushStream(jsonObject, fromId, serial);
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||
return;
|
||||
}
|
||||
// 确定流是否在线
|
||||
Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
|
||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
|
||||
if (streamReady != null && streamReady) {
|
||||
logger.info("[回复推流信息] {}/{}", content.getApp(), content.getStream());
|
||||
responseSendItem(mediaServerItem, content, toId, serial);
|
||||
|
@ -311,7 +311,7 @@ public class RedisGbPlayMsgListener implements MessageListener {
|
|||
* 将获取到的sendItem发送出去
|
||||
*/
|
||||
private void responseSendItem(MediaServerItem mediaServerItem, RequestSendItemMsg content, String toId, String serial) {
|
||||
SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
|
||||
SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
|
||||
content.getPort(), content.getSsrc(), content.getPlatformId(),
|
||||
content.getApp(), content.getStream(), content.getChannelId(),
|
||||
content.getTcp(), content.getRtcp());
|
||||
|
|
|
@ -58,7 +58,7 @@ public class RedisPushStreamCloseResponseListener implements MessageListener {
|
|||
private IMediaServerService mediaServerService;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
private ZLMServerFactory zlmServerFactory;
|
||||
|
||||
|
||||
private Map<String, PushStreamResponseEvent> responseEvents = new ConcurrentHashMap<>();
|
||||
|
@ -89,7 +89,7 @@ public class RedisPushStreamCloseResponseListener implements MessageListener {
|
|||
logger.info("[REDIS消息-推流结束] 停止向上级推流:{}", streamId);
|
||||
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStreamId());
|
||||
ZLMServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
zlmServerFactory.stopSendRtpStream(mediaInfo, param);
|
||||
|
||||
try {
|
||||
commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem);
|
||||
|
|
|
@ -11,11 +11,9 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
|||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||
import com.genersoft.iot.vmp.service.IPlayService;
|
||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
|
@ -53,15 +51,9 @@ public class PlaybackController {
|
|||
@Autowired
|
||||
private SIPCommander cmder;
|
||||
|
||||
@Autowired
|
||||
private ZLMServerFactory ZLMServerFactory;
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorage storager;
|
||||
|
||||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
@Autowired
|
||||
private IInviteStreamService inviteStreamService;
|
||||
|
||||
|
|
Loading…
Reference in New Issue