Commit b3c4636520e58c27a71409c764c2017c695682c1
1 parent
039fbf7e
主线合并talk模式
Showing
5 changed files
with
9 additions
and
22 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java
| @@ -63,8 +63,6 @@ public class AudioBroadcastCatch { | @@ -63,8 +63,6 @@ public class AudioBroadcastCatch { | ||
| 63 | */ | 63 | */ |
| 64 | private SipTransactionInfo sipTransactionInfo; | 64 | private SipTransactionInfo sipTransactionInfo; |
| 65 | 65 | ||
| 66 | - private MediaServerItem mediaServerItem; | ||
| 67 | - | ||
| 68 | 66 | ||
| 69 | public String getDeviceId() { | 67 | public String getDeviceId() { |
| 70 | return deviceId; | 68 | return deviceId; |
| @@ -94,14 +92,6 @@ public class AudioBroadcastCatch { | @@ -94,14 +92,6 @@ public class AudioBroadcastCatch { | ||
| 94 | return sipTransactionInfo; | 92 | return sipTransactionInfo; |
| 95 | } | 93 | } |
| 96 | 94 | ||
| 97 | - public MediaServerItem getMediaServerItem() { | ||
| 98 | - return mediaServerItem; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public void setMediaServerItem(MediaServerItem mediaServerItem) { | ||
| 102 | - this.mediaServerItem = mediaServerItem; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | public String getApp() { | 95 | public String getApp() { |
| 106 | return app; | 96 | return app; |
| 107 | } | 97 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| @@ -986,22 +986,20 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -986,22 +986,20 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 986 | logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc, | 986 | logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc, |
| 987 | mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP"); | 987 | mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP"); |
| 988 | 988 | ||
| 989 | - MediaServerItem mediaServerItem = audioBroadcastCatch.getMediaServerItem(); | 989 | + MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); |
| 990 | if (mediaServerItem == null) { | 990 | if (mediaServerItem == null) { |
| 991 | logger.warn("未找到语音喊话使用的zlm"); | 991 | logger.warn("未找到语音喊话使用的zlm"); |
| 992 | try { | 992 | try { |
| 993 | responseAck(request, Response.BUSY_HERE); | 993 | responseAck(request, Response.BUSY_HERE); |
| 994 | } catch (SipException | InvalidArgumentException | ParseException e) { | 994 | } catch (SipException | InvalidArgumentException | ParseException e) { |
| 995 | logger.error("[命令发送失败] invite 未找到可用的zlm: {}", e.getMessage()); | 995 | logger.error("[命令发送失败] invite 未找到可用的zlm: {}", e.getMessage()); |
| 996 | - playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId()); | 996 | + playService.stopAudioBroadcast(device.getDeviceId(), broadcastCatch.getChannelId()); |
| 997 | } | 997 | } |
| 998 | return; | 998 | return; |
| 999 | } | 999 | } |
| 1000 | - String addressStr = sdp.getConnection().getAddress(); | ||
| 1001 | logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc, | 1000 | logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc, |
| 1002 | mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue()); | 1001 | mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue()); |
| 1003 | 1002 | ||
| 1004 | - MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); | ||
| 1005 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | 1003 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| 1006 | device.getDeviceId(), broadcastCatch.getChannelId(), | 1004 | device.getDeviceId(), broadcastCatch.getChannelId(), |
| 1007 | mediaTransmissionTCP, false); | 1005 | mediaTransmissionTCP, false); |
| @@ -1025,7 +1023,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -1025,7 +1023,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 1025 | sendRtpItem.setPlatformId(requesterId); | 1023 | sendRtpItem.setPlatformId(requesterId); |
| 1026 | sendRtpItem.setStatus(1); | 1024 | sendRtpItem.setStatus(1); |
| 1027 | sendRtpItem.setApp(broadcastCatch.getApp()); | 1025 | sendRtpItem.setApp(broadcastCatch.getApp()); |
| 1028 | - sendRtpItem.setStreamId(broadcastCatch.getStream()); | 1026 | + sendRtpItem.setStream(broadcastCatch.getStream()); |
| 1029 | sendRtpItem.setPt(8); | 1027 | sendRtpItem.setPt(8); |
| 1030 | sendRtpItem.setUsePs(false); | 1028 | sendRtpItem.setUsePs(false); |
| 1031 | sendRtpItem.setRtcp(false); | 1029 | sendRtpItem.setRtcp(false); |
src/main/java/com/genersoft/iot/vmp/service/IPlayService.java
| @@ -12,7 +12,6 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | @@ -12,7 +12,6 @@ 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.gb28181.play.bean.AudioEvent; | ||
| 16 | import gov.nist.javax.sip.message.SIPResponse; | 15 | import gov.nist.javax.sip.message.SIPResponse; |
| 17 | 16 | ||
| 18 | import javax.sip.InvalidArgumentException; | 17 | import javax.sip.InvalidArgumentException; |
| @@ -68,7 +67,7 @@ public interface IPlayService { | @@ -68,7 +67,7 @@ public interface IPlayService { | ||
| 68 | void startSendRtpStreamHand(SendRtpItem sendRtpItem, ParentPlatform parentPlatform, | 67 | void startSendRtpStreamHand(SendRtpItem sendRtpItem, ParentPlatform parentPlatform, |
| 69 | JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader); | 68 | JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader); |
| 70 | 69 | ||
| 71 | - void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioEvent event); | 70 | + void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioBroadcastEvent event); |
| 72 | 71 | ||
| 73 | void stopTalk(Device device, String channelId, Boolean streamIsReady); | 72 | void stopTalk(Device device, String channelId, Boolean streamIsReady); |
| 74 | } | 73 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -41,7 +41,7 @@ import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; | @@ -41,7 +41,7 @@ import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; | ||
| 41 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | 41 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 42 | import com.genersoft.iot.vmp.vmanager.bean.StreamContent; | 42 | import com.genersoft.iot.vmp.vmanager.bean.StreamContent; |
| 43 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 43 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 44 | -import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioEvent; | 44 | +import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent; |
| 45 | import gov.nist.javax.sip.message.SIPResponse; | 45 | import gov.nist.javax.sip.message.SIPResponse; |
| 46 | import org.slf4j.Logger; | 46 | import org.slf4j.Logger; |
| 47 | import org.slf4j.LoggerFactory; | 47 | import org.slf4j.LoggerFactory; |
| @@ -245,7 +245,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -245,7 +245,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 245 | 245 | ||
| 246 | private void talk(MediaServerItem mediaServerItem, Device device, String channelId, String stream, | 246 | private void talk(MediaServerItem mediaServerItem, Device device, String channelId, String stream, |
| 247 | ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent, | 247 | ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent, |
| 248 | - Runnable timeoutCallback, AudioEvent audioEvent) { | 248 | + Runnable timeoutCallback, AudioBroadcastEvent audioEvent) { |
| 249 | 249 | ||
| 250 | String playSsrc = mediaServerItem.getSsrcConfig().getPlaySsrc(); | 250 | String playSsrc = mediaServerItem.getSsrcConfig().getPlaySsrc(); |
| 251 | if (playSsrc == null) { | 251 | if (playSsrc == null) { |
| @@ -982,7 +982,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -982,7 +982,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 982 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); | 982 | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); |
| 983 | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { | 983 | if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { |
| 984 | // 查询流是否存在,不存在则认为是异常状态 | 984 | // 查询流是否存在,不存在则认为是异常状态 |
| 985 | - Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStreamId()); | 985 | + Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| 986 | if (streamReady) { | 986 | if (streamReady) { |
| 987 | logger.warn("语音广播已经开启: {}", channelId); | 987 | logger.warn("语音广播已经开启: {}", channelId); |
| 988 | event.call("语音广播已经开启"); | 988 | event.call("语音广播已经开启"); |
| @@ -1253,7 +1253,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -1253,7 +1253,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 1253 | } | 1253 | } |
| 1254 | 1254 | ||
| 1255 | @Override | 1255 | @Override |
| 1256 | - public void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioEvent event) { | 1256 | + public void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioBroadcastEvent event) { |
| 1257 | if (device == null || channelId == null) { | 1257 | if (device == null || channelId == null) { |
| 1258 | return; | 1258 | return; |
| 1259 | } | 1259 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/bean/AudioEvent.java renamed to src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/bean/AudioBroadcastEvent.java
| @@ -4,6 +4,6 @@ package com.genersoft.iot.vmp.vmanager.gb28181.play.bean; | @@ -4,6 +4,6 @@ package com.genersoft.iot.vmp.vmanager.gb28181.play.bean; | ||
| 4 | /** | 4 | /** |
| 5 | * @author lin | 5 | * @author lin |
| 6 | */ | 6 | */ |
| 7 | -public interface AudioEvent { | 7 | +public interface AudioBroadcastEvent { |
| 8 | void call(String msg); | 8 | void call(String msg); |
| 9 | } | 9 | } |