Commit 4362a5b499692ff31ae02744428696a5894f2439
1 parent
26bdf2e7
主线合并对讲broadcast级联模式
Showing
6 changed files
with
19 additions
and
49 deletions
src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java
| @@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean; | @@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean; | ||
| 10 | import org.springframework.context.annotation.Configuration; | 10 | import org.springframework.context.annotation.Configuration; |
| 11 | import org.springframework.core.annotation.Order; | 11 | import org.springframework.core.annotation.Order; |
| 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; | 12 | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 13 | -import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; | ||
| 14 | import org.springframework.data.redis.core.RedisTemplate; | 13 | import org.springframework.data.redis.core.RedisTemplate; |
| 15 | import org.springframework.data.redis.listener.PatternTopic; | 14 | import org.springframework.data.redis.listener.PatternTopic; |
| 16 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 15 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| @@ -50,8 +49,6 @@ public class RedisConfig extends CachingConfigurerSupport { | @@ -50,8 +49,6 @@ public class RedisConfig extends CachingConfigurerSupport { | ||
| 50 | 49 | ||
| 51 | @Bean | 50 | @Bean |
| 52 | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { | 51 | public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) { |
| 53 | - LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory; | ||
| 54 | - lettuceConnectionFactory.afterPropertiesSet(); | ||
| 55 | 52 | ||
| 56 | RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); | 53 | RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>(); |
| 57 | // 使用fastJson序列化 | 54 | // 使用fastJson序列化 |
| @@ -63,7 +60,7 @@ public class RedisConfig extends CachingConfigurerSupport { | @@ -63,7 +60,7 @@ public class RedisConfig extends CachingConfigurerSupport { | ||
| 63 | // key的序列化采用StringRedisSerializer | 60 | // key的序列化采用StringRedisSerializer |
| 64 | redisTemplate.setKeySerializer(new StringRedisSerializer()); | 61 | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| 65 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); | 62 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| 66 | - redisTemplate.setConnectionFactory(lettuceConnectionFactory); | 63 | + redisTemplate.setConnectionFactory(redisConnectionFactory); |
| 67 | return redisTemplate; | 64 | return redisTemplate; |
| 68 | } | 65 | } |
| 69 | 66 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java
| @@ -109,30 +109,6 @@ public class AudioBroadcastCatch { | @@ -109,30 +109,6 @@ public class AudioBroadcastCatch { | ||
| 109 | return sipTransactionInfo; | 109 | return sipTransactionInfo; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | - public String getApp() { | ||
| 113 | - return app; | ||
| 114 | - } | ||
| 115 | - | ||
| 116 | - public void setApp(String app) { | ||
| 117 | - this.app = app; | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - public String getStream() { | ||
| 121 | - return stream; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - public void setStream(String stream) { | ||
| 125 | - this.stream = stream; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) { | ||
| 129 | - this.sipTransactionInfo = sipTransactionInfo; | ||
| 130 | - } | ||
| 131 | - | ||
| 132 | - public void setSipTransactionInfoByRequset(SIPResponse response) { | ||
| 133 | - this.sipTransactionInfo = new SipTransactionInfo(response, false); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | public MediaServerItem getMediaServerItem() { | 112 | public MediaServerItem getMediaServerItem() { |
| 137 | return mediaServerItem; | 113 | return mediaServerItem; |
| 138 | } | 114 | } |
| @@ -141,14 +117,6 @@ public class AudioBroadcastCatch { | @@ -141,14 +117,6 @@ public class AudioBroadcastCatch { | ||
| 141 | this.mediaServerItem = mediaServerItem; | 117 | this.mediaServerItem = mediaServerItem; |
| 142 | } | 118 | } |
| 143 | 119 | ||
| 144 | - public AudioBroadcastEvent getEvent() { | ||
| 145 | - return event; | ||
| 146 | - } | ||
| 147 | - | ||
| 148 | - public void setEvent(AudioBroadcastEvent event) { | ||
| 149 | - this.event = event; | ||
| 150 | - } | ||
| 151 | - | ||
| 152 | public String getApp() { | 120 | public String getApp() { |
| 153 | return app; | 121 | return app; |
| 154 | } | 122 | } |
| @@ -173,11 +141,19 @@ public class AudioBroadcastCatch { | @@ -173,11 +141,19 @@ public class AudioBroadcastCatch { | ||
| 173 | isFromPlatform = fromPlatform; | 141 | isFromPlatform = fromPlatform; |
| 174 | } | 142 | } |
| 175 | 143 | ||
| 176 | - public MediaServerItem getMediaServerItem() { | ||
| 177 | - return mediaServerItem; | 144 | + public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) { |
| 145 | + this.sipTransactionInfo = sipTransactionInfo; | ||
| 178 | } | 146 | } |
| 179 | 147 | ||
| 180 | - public void setMediaServerItem(MediaServerItem mediaServerItem) { | ||
| 181 | - this.mediaServerItem = mediaServerItem; | 148 | + public AudioBroadcastEvent getEvent() { |
| 149 | + return event; | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + public void setEvent(AudioBroadcastEvent event) { | ||
| 153 | + this.event = event; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public void setSipTransactionInfoByRequset(SIPResponse sipResponse) { | ||
| 157 | + this.sipTransactionInfo = new SipTransactionInfo(sipResponse); | ||
| 182 | } | 158 | } |
| 183 | } | 159 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -357,11 +357,11 @@ public class ZLMRTPServerFactory { | @@ -357,11 +357,11 @@ public class ZLMRTPServerFactory { | ||
| 357 | 357 | ||
| 358 | public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) { | 358 | public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) { |
| 359 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; | 359 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| 360 | - logger.info("rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); | 360 | + logger.info("rtp/{}开始向上级推流, 目标={}:{},SSRC={}", sendRtpItem.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc()); |
| 361 | Map<String, Object> param = new HashMap<>(12); | 361 | Map<String, Object> param = new HashMap<>(12); |
| 362 | param.put("vhost","__defaultVhost__"); | 362 | param.put("vhost","__defaultVhost__"); |
| 363 | param.put("app",sendRtpItem.getApp()); | 363 | param.put("app",sendRtpItem.getApp()); |
| 364 | - param.put("stream",sendRtpItem.getStreamId()); | 364 | + param.put("stream",sendRtpItem.getStream()); |
| 365 | param.put("ssrc", sendRtpItem.getSsrc()); | 365 | param.put("ssrc", sendRtpItem.getSsrc()); |
| 366 | param.put("src_port", sendRtpItem.getLocalPort()); | 366 | param.put("src_port", sendRtpItem.getLocalPort()); |
| 367 | param.put("pt", sendRtpItem.getPt()); | 367 | param.put("pt", sendRtpItem.getPt()); |
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
| @@ -12,9 +12,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | @@ -12,9 +12,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | ||
| 12 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 12 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 13 | import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; | 13 | import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; |
| 14 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent; | 14 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent; |
| 15 | -import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 16 | import gov.nist.javax.sip.message.SIPResponse; | 15 | import gov.nist.javax.sip.message.SIPResponse; |
| 17 | -import org.springframework.web.context.request.async.DeferredResult; | ||
| 18 | 16 | ||
| 19 | import javax.sip.InvalidArgumentException; | 17 | import javax.sip.InvalidArgumentException; |
| 20 | import javax.sip.SipException; | 18 | import javax.sip.SipException; |
| @@ -63,8 +61,6 @@ public interface IPlayService { | @@ -63,8 +61,6 @@ public interface IPlayService { | ||
| 63 | 61 | ||
| 64 | void stopAudioBroadcast(String deviceId, String channelId); | 62 | void stopAudioBroadcast(String deviceId, String channelId); |
| 65 | 63 | ||
| 66 | - void audioBroadcastCmd(Device device, String channelId, int timeout, MediaServerItem mediaServerItem, String sourceApp, String sourceStream, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException; | ||
| 67 | - | ||
| 68 | void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; | 64 | void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; |
| 69 | 65 | ||
| 70 | void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; | 66 | void resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -999,7 +999,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -999,7 +999,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 999 | if (streamReady) { | 999 | if (streamReady) { |
| 1000 | logger.warn("[语音对讲] 进行中: {}", channelId); | 1000 | logger.warn("[语音对讲] 进行中: {}", channelId); |
| 1001 | event.call("语音对讲进行中"); | 1001 | event.call("语音对讲进行中"); |
| 1002 | - return; | 1002 | + return false; |
| 1003 | } else { | 1003 | } else { |
| 1004 | stopTalk(device, channelId); | 1004 | stopTalk(device, channelId); |
| 1005 | } | 1005 | } |
| @@ -1026,7 +1026,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -1026,7 +1026,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 1026 | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { | 1026 | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { |
| 1027 | // 查询流是否存在,不存在则认为是异常状态 | 1027 | // 查询流是否存在,不存在则认为是异常状态 |
| 1028 | MediaServerItem mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 1028 | MediaServerItem mediaServerServiceOne = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 1029 | - Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStreamId()); | 1029 | + Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerServiceOne, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| 1030 | if (streamReady) { | 1030 | if (streamReady) { |
| 1031 | logger.warn("语音广播通道使用中: {}", channelId); | 1031 | logger.warn("语音广播通道使用中: {}", channelId); |
| 1032 | return true; | 1032 | return true; |
| @@ -1073,6 +1073,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -1073,6 +1073,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 1073 | } | 1073 | } |
| 1074 | } | 1074 | } |
| 1075 | 1075 | ||
| 1076 | + | ||
| 1076 | @Override | 1077 | @Override |
| 1077 | public void zlmServerOnline(String mediaServerId) { | 1078 | public void zlmServerOnline(String mediaServerId) { |
| 1078 | // TODO 查找之前的点播,流如果不存在则给下级发送bye | 1079 | // TODO 查找之前的点播,流如果不存在则给下级发送bye |
web_src/src/components/dialog/devicePlayer.vue
| @@ -655,7 +655,7 @@ export default { | @@ -655,7 +655,7 @@ export default { | ||
| 655 | method: 'get', | 655 | method: 'get', |
| 656 | url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode | 656 | url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode |
| 657 | }).then( (res)=> { | 657 | }).then( (res)=> { |
| 658 | - if (res.data.code == 0) { | 658 | + if (res.data.code === 0) { |
| 659 | let streamInfo = res.data.data.streamInfo; | 659 | let streamInfo = res.data.data.streamInfo; |
| 660 | if (document.location.protocol.includes("https")) { | 660 | if (document.location.protocol.includes("https")) { |
| 661 | this.startBroadcast(streamInfo.rtcs) | 661 | this.startBroadcast(streamInfo.rtcs) |