主线合并对讲broadcast级联模式
parent
26bdf2e776
commit
4362a5b499
|
@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.listener.PatternTopic;
|
import org.springframework.data.redis.listener.PatternTopic;
|
||||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||||
|
@ -50,8 +49,6 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||||
LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory;
|
|
||||||
lettuceConnectionFactory.afterPropertiesSet();
|
|
||||||
|
|
||||||
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
||||||
// 使用fastJson序列化
|
// 使用fastJson序列化
|
||||||
|
@ -63,7 +60,7 @@ public class RedisConfig extends CachingConfigurerSupport {
|
||||||
// key的序列化采用StringRedisSerializer
|
// key的序列化采用StringRedisSerializer
|
||||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||||
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||||
redisTemplate.setConnectionFactory(lettuceConnectionFactory);
|
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||||
return redisTemplate;
|
return redisTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,30 +109,6 @@ public class AudioBroadcastCatch {
|
||||||
return sipTransactionInfo;
|
return sipTransactionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getApp() {
|
|
||||||
return app;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApp(String app) {
|
|
||||||
this.app = app;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStream() {
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStream(String stream) {
|
|
||||||
this.stream = stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) {
|
|
||||||
this.sipTransactionInfo = sipTransactionInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSipTransactionInfoByRequset(SIPResponse response) {
|
|
||||||
this.sipTransactionInfo = new SipTransactionInfo(response, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MediaServerItem getMediaServerItem() {
|
public MediaServerItem getMediaServerItem() {
|
||||||
return mediaServerItem;
|
return mediaServerItem;
|
||||||
}
|
}
|
||||||
|
@ -141,14 +117,6 @@ public class AudioBroadcastCatch {
|
||||||
this.mediaServerItem = mediaServerItem;
|
this.mediaServerItem = mediaServerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AudioBroadcastEvent getEvent() {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEvent(AudioBroadcastEvent event) {
|
|
||||||
this.event = event;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getApp() {
|
public String getApp() {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
@ -173,11 +141,19 @@ public class AudioBroadcastCatch {
|
||||||
isFromPlatform = fromPlatform;
|
isFromPlatform = fromPlatform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaServerItem getMediaServerItem() {
|
public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) {
|
||||||
return mediaServerItem;
|
this.sipTransactionInfo = sipTransactionInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaServerItem(MediaServerItem mediaServerItem) {
|
public AudioBroadcastEvent getEvent() {
|
||||||
this.mediaServerItem = mediaServerItem;
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEvent(AudioBroadcastEvent event) {
|
||||||
|
this.event = event;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSipTransactionInfoByRequset(SIPResponse sipResponse) {
|
||||||
|
this.sipTransactionInfo = new SipTransactionInfo(sipResponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,11 +357,11 @@ public class ZLMRTPServerFactory {
|
||||||
|
|
||||||
public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) {
|
public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) {
|
||||||
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
||||||
logger.info("rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
|
logger.info("rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc());
|
||||||
Map<String, Object> param = new HashMap<>(12);
|
Map<String, Object> param = new HashMap<>(12);
|
||||||
param.put("vhost","__defaultVhost__");
|
param.put("vhost","__defaultVhost__");
|
||||||
param.put("app",sendRtpItem.getApp());
|
param.put("app",sendRtpItem.getApp());
|
||||||
param.put("stream",sendRtpItem.getStreamId());
|
param.put("stream",sendRtpItem.getStream());
|
||||||
param.put("ssrc", sendRtpItem.getSsrc());
|
param.put("ssrc", sendRtpItem.getSsrc());
|
||||||
param.put("src_port", sendRtpItem.getLocalPort());
|
param.put("src_port", sendRtpItem.getLocalPort());
|
||||||
param.put("pt", sendRtpItem.getPt());
|
param.put("pt", sendRtpItem.getPt());
|
||||||
|
|
|
@ -12,9 +12,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback;
|
||||||
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
import com.genersoft.iot.vmp.service.bean.SSRCInfo;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult;
|
import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult;
|
||||||
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent;
|
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent;
|
||||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
|
||||||
import gov.nist.javax.sip.message.SIPResponse;
|
import gov.nist.javax.sip.message.SIPResponse;
|
||||||
import org.springframework.web.context.request.async.DeferredResult;
|
|
||||||
|
|
||||||
import javax.sip.InvalidArgumentException;
|
import javax.sip.InvalidArgumentException;
|
||||||
import javax.sip.SipException;
|
import javax.sip.SipException;
|
||||||
|
@ -63,8 +61,6 @@ public interface IPlayService {
|
||||||
|
|
||||||
void stopAudioBroadcast(String deviceId, String channelId);
|
void stopAudioBroadcast(String deviceId, String channelId);
|
||||||
|
|
||||||
void audioBroadcastCmd(Device device, String channelId, int timeout, MediaServerItem mediaServerItem, String sourceApp, String sourceStream, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
|
|
||||||
|
|
||||||
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||||
|
|
||||||
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||||
|
|
|
@ -999,7 +999,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (streamReady) {
|
if (streamReady) {
|
||||||
logger.warn("[语音对讲] 进行中: {}", channelId);
|
logger.warn("[语音对讲] 进行中: {}", channelId);
|
||||||
event.call("语音对讲进行中");
|
event.call("语音对讲进行中");
|
||||||
return;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
stopTalk(device, channelId);
|
stopTalk(device, channelId);
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
||||||
// 查询流是否存在,不存在则认为是异常状态
|
// 查询流是否存在,不存在则认为是异常状态
|
||||||
MediaServerItem mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
MediaServerItem mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||||
Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStreamId());
|
Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||||
if (streamReady) {
|
if (streamReady) {
|
||||||
logger.warn("语音广播通道使用中: {}", channelId);
|
logger.warn("语音广播通道使用中: {}", channelId);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1073,6 +1073,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zlmServerOnline(String mediaServerId) {
|
public void zlmServerOnline(String mediaServerId) {
|
||||||
// TODO 查找之前的点播,流如果不存在则给下级发送bye
|
// TODO 查找之前的点播,流如果不存在则给下级发送bye
|
||||||
|
|
|
@ -655,7 +655,7 @@ export default {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode
|
url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode
|
||||||
}).then( (res)=> {
|
}).then( (res)=> {
|
||||||
if (res.data.code == 0) {
|
if (res.data.code === 0) {
|
||||||
let streamInfo = res.data.data.streamInfo;
|
let streamInfo = res.data.data.streamInfo;
|
||||||
if (document.location.protocol.includes("https")) {
|
if (document.location.protocol.includes("https")) {
|
||||||
this.startBroadcast(streamInfo.rtcs)
|
this.startBroadcast(streamInfo.rtcs)
|
||||||
|
|
Loading…
Reference in New Issue