Merge branch 'ssrc-bugfix-20240202' into wvp-28181-2.0

# Conflicts:
#	src/main/resources/application-dev.yml
This commit is contained in:
zxb 2024-02-24 23:17:14 +08:00
commit c871fc5a61
13 changed files with 37 additions and 17 deletions

View File

@ -56,7 +56,7 @@ public class UserSetting {
private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE; private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
private Boolean deviceStatusNotify = Boolean.FALSE; private Boolean deviceStatusNotify = Boolean.TRUE;
private Boolean useCustomSsrcForParentInvite = Boolean.TRUE; private Boolean useCustomSsrcForParentInvite = Boolean.TRUE;
private String serverId = "000000"; private String serverId = "000000";

View File

@ -25,6 +25,7 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
/** /**
* 配置Spring Security * 配置Spring Security
@ -135,8 +136,14 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
corsConfiguration.setAllowedHeaders(Arrays.asList("*")); corsConfiguration.setAllowedHeaders(Arrays.asList("*"));
corsConfiguration.setAllowedMethods(Arrays.asList("*")); corsConfiguration.setAllowedMethods(Arrays.asList("*"));
corsConfiguration.setMaxAge(3600L); corsConfiguration.setMaxAge(3600L);
if (userSetting.getAllowedOrigins() != null && !userSetting.getAllowedOrigins().isEmpty()) {
corsConfiguration.setAllowCredentials(true); corsConfiguration.setAllowCredentials(true);
corsConfiguration.setAllowedOrigins(userSetting.getAllowedOrigins()); corsConfiguration.setAllowedOrigins(userSetting.getAllowedOrigins());
}else {
corsConfiguration.setAllowCredentials(false);
corsConfiguration.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL));
}
corsConfiguration.setExposedHeaders(Arrays.asList(JwtUtils.getHeader())); corsConfiguration.setExposedHeaders(Arrays.asList(JwtUtils.getHeader()));
UrlBasedCorsConfigurationSource url = new UrlBasedCorsConfigurationSource(); UrlBasedCorsConfigurationSource url = new UrlBasedCorsConfigurationSource();

View File

@ -38,7 +38,8 @@ public class SSRCFactory {
public void initMediaServerSSRC(String mediaServerId, Set<String> usedSet) { public void initMediaServerSSRC(String mediaServerId, Set<String> usedSet) {
String ssrcPrefix = sipConfig.getDomain().substring(3, 8); String sipDomain = sipConfig.getDomain();
String ssrcPrefix = sipDomain.length() >= 8 ? sipDomain.substring(3, 8) : sipDomain;
String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId; String redisKey = SSRC_INFO_KEY + userSetting.getServerId() + "_" + mediaServerId;
List<String> ssrcList = new ArrayList<>(); List<String> ssrcList = new ArrayList<>();
for (int i = 1; i < MAX_STREAM_COUNT; i++) { for (int i = 1; i < MAX_STREAM_COUNT; i++) {

View File

@ -617,6 +617,10 @@ public class SIPCommander implements ISIPCommander {
*/ */
@Override @Override
public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException { public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
if (device == null) {
logger.warn("[发送BYE] device为null");
return;
}
List<SsrcTransaction> ssrcTransactionList = streamSession.getSsrcTransactionForAll(device.getDeviceId(), channelId, callId, stream); List<SsrcTransaction> ssrcTransactionList = streamSession.getSsrcTransactionForAll(device.getDeviceId(), channelId, callId, stream);
if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) { if (ssrcTransactionList == null || ssrcTransactionList.isEmpty()) {
logger.info("[发送BYE] 未找到事务信息,设备: device: {}, channel: {}", device.getDeviceId(), channelId); logger.info("[发送BYE] 未找到事务信息,设备: device: {}, channel: {}", device.getDeviceId(), channelId);
@ -631,6 +635,7 @@ public class SIPCommander implements ISIPCommander {
streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId()); streamSession.removeByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getCallId());
Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo()); Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent); sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
} }
} }

View File

@ -31,7 +31,6 @@ import javax.sip.header.CallIdHeader;
import javax.sip.message.Response; import javax.sip.message.Response;
import java.text.ParseException; import java.text.ParseException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -117,6 +116,9 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),
callIdHeader.getCallId(), null); callIdHeader.getCallId(), null);
zlmServerFactory.stopSendRtpStream(mediaInfo, param); zlmServerFactory.stopSendRtpStream(mediaInfo, param);
if (userSetting.getUseCustomSsrcForParentInvite()) {
mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc());
}
if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) {
ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
if (platform != null) { if (platform != null) {

View File

@ -848,7 +848,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
// 发送redis消息 // 发送redis消息
redisGbPlayMsgListener.sendMsg(streamPushItem.getServerId(), streamPushItem.getMediaServerId(), redisGbPlayMsgListener.sendMsg(streamPushItem.getServerId(), streamPushItem.getMediaServerId(),
streamPushItem.getApp(), streamPushItem.getStream(), addressStr, port, ssrc, requesterId, streamPushItem.getApp(), streamPushItem.getStream(), addressStr, port, ssrc, requesterId,
channelId, mediaTransmissionTCP, platform.isRtcp(),null, responseSendItemMsg -> { channelId, mediaTransmissionTCP, platform.isRtcp(),platform.getName(), responseSendItemMsg -> {
SendRtpItem sendRtpItem = responseSendItemMsg.getSendRtpItem(); SendRtpItem sendRtpItem = responseSendItemMsg.getSendRtpItem();
if (sendRtpItem == null || responseSendItemMsg.getMediaServerItem() == null) { if (sendRtpItem == null || responseSendItemMsg.getMediaServerItem() == null) {
logger.warn("服务器端口资源不足"); logger.warn("服务器端口资源不足");

View File

@ -161,6 +161,7 @@ public class AssistRESTfulUtils {
if (mediaServerItem == null) { if (mediaServerItem == null) {
return null; return null;
} }
logger.info("[访问assist] {}, 参数: {}", url, param);
JSONObject responseJSON = new JSONObject(); JSONObject responseJSON = new JSONObject();
//-2自定义流媒体 调用错误码 //-2自定义流媒体 调用错误码
responseJSON.put("code",-2); responseJSON.put("code",-2);

View File

@ -447,7 +447,7 @@ public class ZLMHttpHookListener {
} }
if (!param.isRegist()) { if (!param.isRegist()) {
List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream()); List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
if (sendRtpItems.size() > 0) { if (!sendRtpItems.isEmpty()) {
for (SendRtpItem sendRtpItem : sendRtpItems) { for (SendRtpItem sendRtpItem : sendRtpItems) {
if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) { if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) {
String platformId = sendRtpItem.getPlatformId(); String platformId = sendRtpItem.getPlatformId();

View File

@ -20,7 +20,7 @@ public interface GbStreamMapper {
"(#{app}, #{stream}, #{gbId}, #{name}, " + "(#{app}, #{stream}, #{gbId}, #{name}, " +
"#{longitude}, #{latitude}, #{streamType}, " + "#{longitude}, #{latitude}, #{streamType}, " +
"#{mediaServerId}, #{createTime})") "#{mediaServerId}, #{createTime})")
@Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gbStreamId") @Options(useGeneratedKeys = true, keyProperty = "gbStreamId", keyColumn = "gb_stream_id")
int add(GbStream gbStream); int add(GbStream gbStream);
@Update("UPDATE wvp_gb_stream " + @Update("UPDATE wvp_gb_stream " +

View File

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.storager.impl; package com.genersoft.iot.vmp.storager.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.bean.*; import com.genersoft.iot.vmp.gb28181.bean.*;
@ -38,6 +39,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Component @Component
@DS("master")
public class VideoManagerStorageImpl implements IVideoManagerStorage { public class VideoManagerStorageImpl implements IVideoManagerStorage {
private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class); private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class);

View File

@ -237,7 +237,7 @@ user-settings:
register-again-after-time: 60 register-again-after-time: 60
# 国标续订方式true为续订每次注册在同一个会话里false为重新注册每次使用新的会话 # 国标续订方式true为续订每次注册在同一个会话里false为重新注册每次使用新的会话
register-keep-int-dialog: false register-keep-int-dialog: false
# 跨域配置,配置你访问前端页面的地址即可 可以配置多个 # 跨域配置,不配置此项则允许所有跨域请求,配置后则只允许配置的页面的地址请求 可以配置多个
allowed-origins: allowed-origins:
- http://localhost:8008 - http://localhost:8008
- http://192.168.1.3:8008 - http://192.168.1.3:8008

View File

@ -264,14 +264,16 @@ export default {
}); });
}, },
formatTime(time) { formatTime(time) {
const h = parseInt(time / 3600) const h = parseInt(time / 3600 / 1000)
const minute = parseInt(time / 60 % 60) const minute = parseInt((time - h * 3600 * 1000) / 60 / 1000)
const second = Math.ceil(time % 60) let second = Math.ceil((time - h * 3600 * 1000 - minute * 60 * 1000) / 1000)
if (second < 0) {
return (h > 0 ? h + `小时` : '') + (minute > 0 ? minute + '分' : '') + second + '秒' second = 0;
}
return (h > 0 ? h + `小时` : '') + (minute > 0 ? minute + '分' : '') + (second > 0 ? second + '秒' : '')
}, },
formatTimeStamp(time) { formatTimeStamp(time) {
return moment.unix(time).format('yyyy-MM-DD HH:mm:ss') return moment.unix(time/1000).format('yyyy-MM-DD HH:mm:ss')
} }
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div ref="container" @dblclick="fullscreenSwich" <div ref="container" @dblclick="fullscreenSwich"
style="width:100%;height:100%;min-height: 200px;background-color: #000000;margin:0 auto;position: relative;"> style="width:100%;height:518px; min-height: 200px;background-color: #000000;margin:0 auto;position: relative;">
<div class="buttons-box" id="buttonsBox"> <div class="buttons-box" id="buttonsBox">
<div class="buttons-box-left"> <div class="buttons-box-left">
<i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i> <i v-if="!playing" class="iconfont icon-play jessibuca-btn" @click="playBtnClick"></i>
@ -46,7 +46,7 @@ export default {
}; };
}, },
props: ['videoUrl', 'error', 'hasAudio', 'height'], props: ['videoUrl', 'error', 'hasAudio', 'height'],
mounted() { created() {
let paramUrl = decodeURIComponent(this.$route.params.url) let paramUrl = decodeURIComponent(this.$route.params.url)
this.$nextTick(() => { this.$nextTick(() => {
this.updatePlayerDomSize() this.updatePlayerDomSize()