修复回看控制失效 #619
This commit is contained in:
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo;
|
||||
@@ -15,6 +16,10 @@ import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.text.ParseException;
|
||||
|
||||
/**
|
||||
* 点播处理
|
||||
*/
|
||||
@@ -42,4 +47,8 @@ public interface IPlayService {
|
||||
StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream);
|
||||
|
||||
void zlmServerOnline(String mediaServerId);
|
||||
|
||||
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
|
||||
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,13 @@ import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.ResponseEvent;
|
||||
import javax.sip.SipException;
|
||||
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -822,4 +825,52 @@ public class PlayServiceImpl implements IPlayService {
|
||||
// }
|
||||
// }));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
String key = redisCatchStorage.queryPlaybackForKey(null, null, streamId, null);
|
||||
StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
|
||||
if (null == streamInfo) {
|
||||
logger.warn("streamId不存在!");
|
||||
throw new ServiceException("streamId不存在");
|
||||
}
|
||||
streamInfo.setPause(true);
|
||||
RedisUtil.set(key, streamInfo);
|
||||
MediaServerItem mediaServerItem = mediaServerService.getOne(streamInfo.getMediaServerId());
|
||||
if (null == mediaServerItem) {
|
||||
logger.warn("mediaServer 不存在!");
|
||||
throw new ServiceException("mediaServer不存在");
|
||||
}
|
||||
// zlm 暂停RTP超时检查
|
||||
JSONObject jsonObject = zlmresTfulUtils.pauseRtpCheck(mediaServerItem, streamId);
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0) {
|
||||
throw new ServiceException("暂停RTP接收失败");
|
||||
}
|
||||
Device device = storager.queryVideoDevice(streamInfo.getDeviceID());
|
||||
cmder.playPauseCmd(device, streamInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException {
|
||||
String key = redisCatchStorage.queryPlaybackForKey(null, null, streamId, null);
|
||||
StreamInfo streamInfo = redisCatchStorage.queryPlayback(null, null, streamId, null);
|
||||
if (null == streamInfo) {
|
||||
logger.warn("streamId不存在!");
|
||||
throw new ServiceException("streamId不存在");
|
||||
}
|
||||
streamInfo.setPause(false);
|
||||
RedisUtil.set(key, streamInfo);
|
||||
MediaServerItem mediaServerItem = mediaServerService.getOne(streamInfo.getMediaServerId());
|
||||
if (null == mediaServerItem) {
|
||||
logger.warn("mediaServer 不存在!");
|
||||
throw new ServiceException("mediaServer不存在");
|
||||
}
|
||||
// zlm 暂停RTP超时检查
|
||||
JSONObject jsonObject = zlmresTfulUtils.resumeRtpCheck(mediaServerItem, streamId);
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0) {
|
||||
throw new ServiceException("继续RTP接收失败");
|
||||
}
|
||||
Device device = storager.queryVideoDevice(streamInfo.getDeviceID());
|
||||
cmder.playResumeCmd(device, streamInfo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user