修复点播错误时关闭rtpserver
parent
6dd870e74c
commit
ab318fcf70
|
@ -278,7 +278,6 @@ public class SIPCommander implements ISIPCommander {
|
||||||
|
|
||||||
logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getSdpIp(), ssrcInfo.getPort());
|
logger.info("{} 分配的ZLM为: {} [{}:{}]", stream, mediaServerItem.getId(), mediaServerItem.getSdpIp(), ssrcInfo.getPort());
|
||||||
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, "rtp", stream, mediaServerItem.getId());
|
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, "rtp", stream, mediaServerItem.getId());
|
||||||
System.out.println("rtpHook: " + rtpHook.toString());
|
|
||||||
subscribe.addSubscribe(rtpHook, (hookData) -> {
|
subscribe.addSubscribe(rtpHook, (hookData) -> {
|
||||||
if (event != null) {
|
if (event != null) {
|
||||||
event.response(hookData);
|
event.response(hookData);
|
||||||
|
|
|
@ -27,7 +27,6 @@ import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager;
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
|
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.StreamPushItem;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
|
||||||
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.service.IPlayService;
|
import com.genersoft.iot.vmp.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||||
|
@ -493,12 +492,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ErrorCallback<Object> errorEvent = ((statusCode, msg, data) -> {
|
ErrorCallback<Object> errorEvent = ((statusCode, msg, data) -> {
|
||||||
|
logger.info("[上级Invite] {}, 失败, 平台:{}, 通道:{}, code: {}, msg;{}", sessionName, username, channelId, statusCode, msg);
|
||||||
// 未知错误。直接转发设备点播的错误
|
// 未知错误。直接转发设备点播的错误
|
||||||
try {
|
try {
|
||||||
if (statusCode > 0) {
|
Response response = getMessageFactory().createResponse(statusCode, evt.getRequest());
|
||||||
Response response = getMessageFactory().createResponse(statusCode, evt.getRequest());
|
sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response);
|
||||||
sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response);
|
|
||||||
}
|
|
||||||
} catch (ParseException | SipException e) {
|
} catch (ParseException | SipException e) {
|
||||||
logger.error("未处理的异常 ", e);
|
logger.error("未处理的异常 ", e);
|
||||||
}
|
}
|
||||||
|
@ -589,12 +587,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
if ("push".equals(gbStream.getStreamType())) {
|
if ("push".equals(gbStream.getStreamType())) {
|
||||||
if (streamPushItem != null) {
|
if (streamPushItem != null) {
|
||||||
// 从redis查询是否正在接收这个推流
|
// 从redis查询是否正在接收这个推流
|
||||||
OnStreamChangedHookParam pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
StreamPushItem pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream());
|
||||||
if (pushListItem != null) {
|
if (pushListItem != null) {
|
||||||
StreamPushItem transform = streamPushService.transform(pushListItem);
|
pushListItem.setSelf(userSetting.getServerId().equals(pushListItem.getServerId()));
|
||||||
transform.setSelf(userSetting.getServerId().equals(pushListItem.getSeverId()));
|
|
||||||
// 推流状态
|
// 推流状态
|
||||||
pushStream(evt, request, gbStream, transform, platform, callIdHeader, mediaServerItem, port, tcpActive,
|
pushStream(evt, request, gbStream, pushListItem, platform, callIdHeader, mediaServerItem, port, tcpActive,
|
||||||
mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId);
|
mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId);
|
||||||
}else {
|
}else {
|
||||||
// 未推流 拉起
|
// 未推流 拉起
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeRtpServer(MediaServer mediaServer, String streamId) {
|
public void closeRtpServer(MediaServer mediaServer, String streamId) {
|
||||||
zlmresTfulUtils.closeStreams(mediaServer, "rtp", streamId);
|
zlmServerFactory.closeRtpServer(mediaServer, streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -104,8 +104,6 @@ public class ZLMRESTfulUtils {
|
||||||
responseJSON = JSON.parseObject(responseStr);
|
responseJSON = JSON.parseObject(responseStr);
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
System.out.println( 2222);
|
|
||||||
System.out.println( response.code());
|
|
||||||
response.close();
|
response.close();
|
||||||
Objects.requireNonNull(response.body()).close();
|
Objects.requireNonNull(response.body()).close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -646,7 +646,6 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
inviteInfo.setStatus(InviteSessionStatus.ok);
|
inviteInfo.setStatus(InviteSessionStatus.ok);
|
||||||
ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
|
ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
|
||||||
String contentString = new String(responseEvent.getResponse().getRawContent());
|
String contentString = new String(responseEvent.getResponse().getRawContent());
|
||||||
System.out.println(1111);
|
|
||||||
System.out.println(contentString);
|
System.out.println(contentString);
|
||||||
String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString);
|
String ssrcInResponse = SipUtils.getSsrcFromSdp(contentString);
|
||||||
// 兼容回复的消息中缺少ssrc(y字段)的情况
|
// 兼容回复的消息中缺少ssrc(y字段)的情况
|
||||||
|
|
|
@ -581,8 +581,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
|
|
||||||
streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
|
streamSession.remove(device.getDeviceId(), channel.getChannelId(), ssrcInfo.getStream());
|
||||||
|
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SIGNALLING_ERROR.getCode(),
|
callback.run(event.statusCode, event.msg, null);
|
||||||
String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null);
|
|
||||||
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
|
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channel.getChannelId(), null,
|
||||||
InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
||||||
String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null);
|
String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg), null);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
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.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||||
|
@ -212,7 +213,7 @@ public interface IRedisCatchStorage {
|
||||||
|
|
||||||
void addPushListItem(String app, String stream, MediaArrivalEvent param);
|
void addPushListItem(String app, String stream, MediaArrivalEvent param);
|
||||||
|
|
||||||
OnStreamChangedHookParam getPushListItem(String app, String stream);
|
StreamPushItem getPushListItem(String app, String stream);
|
||||||
|
|
||||||
void removePushListItem(String app, String stream, String mediaServerId);
|
void removePushListItem(String app, String stream, String mediaServerId);
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||||
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo;
|
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.hook.OnStreamChangedHookParam;
|
||||||
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
import com.genersoft.iot.vmp.service.bean.GPSMsgInfo;
|
||||||
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
|
||||||
|
@ -447,7 +448,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
@Override
|
@Override
|
||||||
public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) {
|
public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) {
|
||||||
String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
|
String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ;
|
||||||
System.out.println(key);
|
|
||||||
return JsonUtil.redisJsonToObject(redisTemplate, key, StreamAuthorityInfo.class);
|
return JsonUtil.redisJsonToObject(redisTemplate, key, StreamAuthorityInfo.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -655,19 +655,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||||
@Override
|
@Override
|
||||||
public void addPushListItem(String app, String stream, MediaArrivalEvent event) {
|
public void addPushListItem(String app, String stream, MediaArrivalEvent event) {
|
||||||
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
||||||
redisTemplate.opsForValue().set(key, event);
|
StreamPushItem streamPushItem = StreamPushItem.getInstance(event, userSetting.getServerId());
|
||||||
|
redisTemplate.opsForValue().set(key, streamPushItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OnStreamChangedHookParam getPushListItem(String app, String stream) {
|
public StreamPushItem getPushListItem(String app, String stream) {
|
||||||
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
||||||
return (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key);
|
return (StreamPushItem)redisTemplate.opsForValue().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePushListItem(String app, String stream, String mediaServerId) {
|
public void removePushListItem(String app, String stream, String mediaServerId) {
|
||||||
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream;
|
||||||
OnStreamChangedHookParam param = (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key);
|
StreamPushItem param = (StreamPushItem)redisTemplate.opsForValue().get(key);
|
||||||
if (param != null && param.getMediaServerId().equalsIgnoreCase(mediaServerId)) {
|
if (param != null && param.getMediaServerId().equalsIgnoreCase(mediaServerId)) {
|
||||||
redisTemplate.delete(key);
|
redisTemplate.delete(key);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue