增加对设备的兼容性

This commit is contained in:
panlinlin
2021-04-22 17:33:07 +08:00
parent ef742e715b
commit a29a0a0785
6 changed files with 24 additions and 23 deletions

View File

@@ -5,7 +5,10 @@ import java.util.List;
import java.util.Random;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @Description:SIP信令中的SSRC工具类。SSRC值由10位十进制整数组成的字符串第一位为0代表实况为1则代表回放第二位至第六位由监控域ID的第4位到第8位组成最后4位为不重复的4个整数
@@ -14,6 +17,8 @@ import com.genersoft.iot.vmp.utils.SpringBeanFactory;
*/
public class SsrcUtil {
private final static Logger logger = LoggerFactory.getLogger(SsrcUtil.class);
private static String ssrcPrefix;
private static List<String> isUsed;
@@ -59,6 +64,10 @@ public class SsrcUtil {
*
*/
public static void releaseSsrc(String ssrc) {
if (ssrc == null) {
logger.error("要释放ssrc为null");
return;
}
String sn = ssrc.substring(6);
isUsed.remove(sn);
notUsed.add(sn);

View File

@@ -42,7 +42,9 @@ public class VideoStreamSessionManager {
public void remove(String deviceId, String channelId) {
sessionMap.remove(deviceId + "_" + channelId);
SsrcUtil.releaseSsrc(ssrcMap.get(deviceId + "_" + channelId));
if (ssrcMap.get(deviceId + "_" + channelId) != null) {
SsrcUtil.releaseSsrc(ssrcMap.get(deviceId + "_" + channelId));
}
ssrcMap.remove(deviceId + "_" + channelId);
streamIdMap.remove(deviceId + "_" + channelId);
}