请求历史媒体下载增加回复事件处理ssrc与下级不一致情况
| | |
| | | *
|
| | | * @param device 视频设备
|
| | | * @param channelId 通道id,非通道则是设备本身
|
| | | * @param frontCmd 上级平台的指令,如果存在则直接下发
|
| | | * @param enabled 看守位使能:1 = 开启,0 = 关闭
|
| | | * @param resetTime 自动归位时间间隔,开启看守位时使用,单位:秒(s)
|
| | | * @param presetIndex 调用预置位编号,开启看守位时使用,取值范围0~255
|
| | |
| | | */
|
| | | @Override
|
| | | public void playbackStreamCmd(MediaServerItem mediaServerItem, SSRCInfo ssrcInfo, Device device, String channelId,
|
| | | String startTime, String endTime,
|
| | | InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
|
| | | String startTime, String endTime, InviteStreamCallback inviteStreamCallback, InviteStreamCallback hookEvent,
|
| | | SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
|
| | |
|
| | |
|
| | |
| | | content.append("a=setup:active\r\n");
|
| | | content.append("a=connection:new\r\n");
|
| | | }
|
| | | } else
|
| | | {
|
| | | } else {
|
| | | if ("TCP-PASSIVE".equalsIgnoreCase(streamMode)) {
|
| | | content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 97 98 99\r\n");
|
| | | } else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) {
|
| | |
| | |
|
| | | 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()));
|
| | | subscribe.removeSubscribe(hookSubscribe);
|
| | | hookSubscribe.getContent().put("regist", false);
|
| | |
| | | return; |
| | | } |
| | | 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()); |
| | | dynamicTask.stop(timeOutTaskKey); |
| | | |
| | |
| | | logger.info("[请求截图]: " + fileName); |
| | | zlmresTfulUtils.getSnap(mediaServerItemInuse, streamUrl, 15, 1, path, fileName); |
| | | |
| | | }, (event) -> |
| | | { |
| | | }, (event) -> { |
| | | ResponseEvent responseEvent = (ResponseEvent) event.event; |
| | | String contentString = new String(responseEvent.getResponse().getRawContent()); |
| | | // 获取ssrc |
| | |
| | | |
| | | } |
| | | } |
| | | }, (event) -> |
| | | { |
| | | }, (event) -> { |
| | | dynamicTask.stop(timeOutTaskKey); |
| | | mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream()); |
| | | // 释放ssrc |
| | |
| | | |
| | | try { |
| | | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, |
| | | hookEvent, eventResult -> |
| | | { |
| | | hookEvent, eventResult -> { |
| | | if (eventResult.type == SipSubscribe.EventResultType.response) { |
| | | ResponseEvent responseEvent = (ResponseEvent) eventResult.event; |
| | | String contentString = new String(responseEvent.getResponse().getRawContent()); |
| | |
| | | if (device == null) { |
| | | return; |
| | | } |
| | | //获取录像下载的服务,配置文件中的record-assist-port不为0 |
| | | MediaServerItem newMediaServerItem = getNewMediaServerItemHasAssist(device); |
| | | if (newMediaServerItem == null) { |
| | | PlayBackResult<StreamInfo> downloadResult = new PlayBackResult<>(); |