From 4362a5b499692ff31ae02744428696a5894f2439 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 20 Mar 2023 15:42:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E7=BA=BF=E5=90=88=E5=B9=B6=E5=AF=B9?= =?UTF-8?q?=E8=AE=B2broadcast=E7=BA=A7=E8=81=94=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/conf/redis/RedisConfig.java | 5 +- .../vmp/gb28181/bean/AudioBroadcastCatch.java | 48 +++++-------------- .../vmp/media/zlm/ZLMRTPServerFactory.java | 4 +- .../iot/vmp/service/IPlayService.java | 4 -- .../iot/vmp/service/impl/PlayServiceImpl.java | 5 +- .../src/components/dialog/devicePlayer.vue | 2 +- 6 files changed, 19 insertions(+), 49 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java index 006a65fd..ab90ac68 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/redis/RedisConfig.java @@ -10,7 +10,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; 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.listener.PatternTopic; import org.springframework.data.redis.listener.RedisMessageListenerContainer; @@ -50,8 +49,6 @@ public class RedisConfig extends CachingConfigurerSupport { @Bean public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { - LettuceConnectionFactory lettuceConnectionFactory = (LettuceConnectionFactory) redisConnectionFactory; - lettuceConnectionFactory.afterPropertiesSet(); RedisTemplate redisTemplate = new RedisTemplate<>(); // 使用fastJson序列化 @@ -63,7 +60,7 @@ public class RedisConfig extends CachingConfigurerSupport { // key的序列化采用StringRedisSerializer redisTemplate.setKeySerializer(new StringRedisSerializer()); redisTemplate.setHashKeySerializer(new StringRedisSerializer()); - redisTemplate.setConnectionFactory(lettuceConnectionFactory); + redisTemplate.setConnectionFactory(redisConnectionFactory); return redisTemplate; } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java index 4fff3520..814d9847 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java @@ -109,30 +109,6 @@ public class AudioBroadcastCatch { 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() { return mediaServerItem; } @@ -141,14 +117,6 @@ public class AudioBroadcastCatch { this.mediaServerItem = mediaServerItem; } - public AudioBroadcastEvent getEvent() { - return event; - } - - public void setEvent(AudioBroadcastEvent event) { - this.event = event; - } - public String getApp() { return app; } @@ -173,11 +141,19 @@ public class AudioBroadcastCatch { isFromPlatform = fromPlatform; } - public MediaServerItem getMediaServerItem() { - return mediaServerItem; + public void setSipTransactionInfo(SipTransactionInfo sipTransactionInfo) { + this.sipTransactionInfo = sipTransactionInfo; } - public void setMediaServerItem(MediaServerItem mediaServerItem) { - this.mediaServerItem = mediaServerItem; + public AudioBroadcastEvent getEvent() { + return event; + } + + public void setEvent(AudioBroadcastEvent event) { + this.event = event; + } + + public void setSipTransactionInfoByRequset(SIPResponse sipResponse) { + this.sipTransactionInfo = new SipTransactionInfo(sipResponse); } } diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java index 9a9dbe16..c8dcdfe2 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java @@ -357,11 +357,11 @@ public class ZLMRTPServerFactory { public JSONObject startSendRtp(MediaServerItem mediaInfo, SendRtpItem sendRtpItem) { 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 param = new HashMap<>(12); param.put("vhost","__defaultVhost__"); param.put("app",sendRtpItem.getApp()); - param.put("stream",sendRtpItem.getStreamId()); + param.put("stream",sendRtpItem.getStream()); param.put("ssrc", sendRtpItem.getSsrc()); param.put("src_port", sendRtpItem.getLocalPort()); param.put("pt", sendRtpItem.getPt()); diff --git a/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java b/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java index 3d6352b4..796bb99a 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java +++ b/src/main/java/com/genersoft/iot/vmp/service/IPlayService.java @@ -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.vmanager.bean.AudioBroadcastResult; 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 org.springframework.web.context.request.async.DeferredResult; import javax.sip.InvalidArgumentException; import javax.sip.SipException; @@ -63,8 +61,6 @@ public interface IPlayService { 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 resumeRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException; diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index 7e85f0c7..eea990d8 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -999,7 +999,7 @@ public class PlayServiceImpl implements IPlayService { if (streamReady) { logger.warn("[语音对讲] 进行中: {}", channelId); event.call("语音对讲进行中"); - return; + return false; } else { stopTalk(device, channelId); } @@ -1026,7 +1026,7 @@ public class PlayServiceImpl implements IPlayService { if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { // 查询流是否存在,不存在则认为是异常状态 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) { logger.warn("语音广播通道使用中: {}", channelId); return true; @@ -1073,6 +1073,7 @@ public class PlayServiceImpl implements IPlayService { } } + @Override public void zlmServerOnline(String mediaServerId) { // TODO 查找之前的点播,流如果不存在则给下级发送bye diff --git a/web_src/src/components/dialog/devicePlayer.vue b/web_src/src/components/dialog/devicePlayer.vue index 61cf0667..94e5b6f7 100644 --- a/web_src/src/components/dialog/devicePlayer.vue +++ b/web_src/src/components/dialog/devicePlayer.vue @@ -655,7 +655,7 @@ export default { method: 'get', url: '/api/play/broadcast/' + this.deviceId + '/' + this.channelId + "?timeout=30&broadcastMode=" + this.broadcastMode }).then( (res)=> { - if (res.data.code == 0) { + if (res.data.code === 0) { let streamInfo = res.data.data.streamInfo; if (document.location.protocol.includes("https")) { this.startBroadcast(streamInfo.rtcs)