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