请求历史媒体下载增加回复事件处理ssrc与下级不一致情况

pull/763/head
wangyimeng 2023-03-04 20:47:48 +08:00
parent a0cdc7c59d
commit c662a53098
3 changed files with 84 additions and 93 deletions

View File

@ -221,7 +221,6 @@ public interface ISIPCommander {
* *
* @param device * @param device
* @param channelId id * @param channelId id
* @param frontCmd
* @param enabled 使1 = 0 = * @param enabled 使1 = 0 =
* @param resetTime 使:(s) * @param resetTime 使:(s)
* @param presetIndex 使0~255 * @param presetIndex 使0~255

View File

@ -364,8 +364,7 @@ public class SIPCommander implements ISIPCommander {
*/ */
@Override @Override
public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId, public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId,
String startTime, String endTime, String startTime, String endTime, InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
@ -411,8 +410,7 @@ public class SIPCommander implements ISIPCommander {
content.append("a=setup:active\r\n"); content.append("a=setup:active\r\n");
content.append("a=connection:new\r\n"); content.append("a=connection:new\r\n");
} }
} else } else {
{
if ("TCP-PASSIVE".equalsIgnoreCase(streamMode)) { if ("TCP-PASSIVE".equalsIgnoreCase(streamMode)) {
content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 97 98 99\r\n"); content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 97 98 99\r\n");
} else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) { } else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) {
@ -546,8 +544,7 @@ public class SIPCommander implements ISIPCommander {
HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, null, mediaServerItem.getId()); HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed("rtp", ssrcInfo.getStream(), true, null, mediaServerItem.getId());
// 添加订阅 // 添加订阅
subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json) -> subscribe.addSubscribe(hookSubscribe, (MediaServerItem mediaServerItemInUse, JSONObject json) -> {
{
hookEvent.call(new InviteStreamInfo(mediaServerItem, json,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()).getCallId(), "rtp", ssrcInfo.getStream())); hookEvent.call(new InviteStreamInfo(mediaServerItem, json,sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()).getCallId(), "rtp", ssrcInfo.getStream()));
subscribe.removeSubscribe(hookSubscribe); subscribe.removeSubscribe(hookSubscribe);
hookSubscribe.getContent().put("regist", false); hookSubscribe.getContent().put("regist", false);

View File

@ -258,8 +258,7 @@ public class PlayServiceImpl implements IPlayService {
return; return;
} }
try { try {
cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> {
{
logger.info("收到订阅消息: " + response.toJSONString()); logger.info("收到订阅消息: " + response.toJSONString());
dynamicTask.stop(timeOutTaskKey); dynamicTask.stop(timeOutTaskKey);
@ -274,8 +273,7 @@ public class PlayServiceImpl implements IPlayService {
logger.info("[请求截图]: " + fileName); logger.info("[请求截图]: " + fileName);
zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName); zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName);
}, (event) -> }, (event) -> {
{
ResponseEvent responseEvent = (ResponseEvent) event.event; ResponseEvent responseEvent = (ResponseEvent) event.event;
String contentString = new String(responseEvent.getResponse().getRawContent()); String contentString = new String(responseEvent.getResponse().getRawContent());
// 获取ssrc // 获取ssrc
@ -324,8 +322,7 @@ public class PlayServiceImpl implements IPlayService {
} }
} }
}, (event) -> }, (event) -> {
{
dynamicTask.stop(timeOutTaskKey); dynamicTask.stop(timeOutTaskKey);
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
// 释放ssrc // 释放ssrc
@ -516,8 +513,7 @@ public class PlayServiceImpl implements IPlayService {
try { try {
cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack,
hookEvent, eventResult -> hookEvent, eventResult -> {
{
if (eventResult.type == SipSubscribe.EventResultType.response) { if (eventResult.type == SipSubscribe.EventResultType.response) {
ResponseEvent responseEvent = (ResponseEvent) eventResult.event; ResponseEvent responseEvent = (ResponseEvent) eventResult.event;
String contentString = new String(responseEvent.getResponse().getRawContent()); String contentString = new String(responseEvent.getResponse().getRawContent());
@ -586,7 +582,6 @@ public class PlayServiceImpl implements IPlayService {
if (device == null) { if (device == null) {
return; return;
} }
//获取录像下载的服务配置文件中的record-assist-port不为0
MediaServerItem newMediaServerItem = getNewMediaServerItemHasAssist(device); MediaServerItem newMediaServerItem = getNewMediaServerItemHasAssist(device);
if (newMediaServerItem == null) { if (newMediaServerItem == null) {
PlayBackResult<StreamInfo> downloadResult = new PlayBackResult<>(); PlayBackResult<StreamInfo> downloadResult = new PlayBackResult<>();