Commit b3c4636520e58c27a71409c764c2017c695682c1

Authored by 648540858
1 parent 039fbf7e

主线合并talk模式

src/main/java/com/genersoft/iot/vmp/gb28181/bean/AudioBroadcastCatch.java
... ... @@ -63,8 +63,6 @@ public class AudioBroadcastCatch {
63 63 */
64 64 private SipTransactionInfo sipTransactionInfo;
65 65  
66   - private MediaServerItem mediaServerItem;
67   -
68 66  
69 67 public String getDeviceId() {
70 68 return deviceId;
... ... @@ -94,14 +92,6 @@ public class AudioBroadcastCatch {
94 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 95 public String getApp() {
106 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 986 logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, ssrc,
987 987 mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP");
988 988  
989   - MediaServerItem mediaServerItem = audioBroadcastCatch.getMediaServerItem();
  989 + MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem();
990 990 if (mediaServerItem == null) {
991 991 logger.warn("未找到语音喊话使用的zlm");
992 992 try {
993 993 responseAck(request, Response.BUSY_HERE);
994 994 } catch (SipException | InvalidArgumentException | ParseException e) {
995 995 logger.error("[命令发送失败] invite 未找到可用的zlm: {}", e.getMessage());
996   - playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId());
  996 + playService.stopAudioBroadcast(device.getDeviceId(), broadcastCatch.getChannelId());
997 997 }
998 998 return;
999 999 }
1000   - String addressStr = sdp.getConnection().getAddress();
1001 1000 logger.info("设备{}请求语音流, 收流地址:{}:{},ssrc:{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc,
1002 1001 mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue());
1003 1002  
1004   - MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem();
1005 1003 SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
1006 1004 device.getDeviceId(), broadcastCatch.getChannelId(),
1007 1005 mediaTransmissionTCP, false);
... ... @@ -1025,7 +1023,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
1025 1023 sendRtpItem.setPlatformId(requesterId);
1026 1024 sendRtpItem.setStatus(1);
1027 1025 sendRtpItem.setApp(broadcastCatch.getApp());
1028   - sendRtpItem.setStreamId(broadcastCatch.getStream());
  1026 + sendRtpItem.setStream(broadcastCatch.getStream());
1029 1027 sendRtpItem.setPt(8);
1030 1028 sendRtpItem.setUsePs(false);
1031 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 12 import com.genersoft.iot.vmp.service.bean.SSRCInfo;
13 13 import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult;
14 14 import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent;
15   -import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioEvent;
16 15 import gov.nist.javax.sip.message.SIPResponse;
17 16  
18 17 import javax.sip.InvalidArgumentException;
... ... @@ -68,7 +67,7 @@ public interface IPlayService {
68 67 void startSendRtpStreamHand(SendRtpItem sendRtpItem, ParentPlatform parentPlatform,
69 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 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 41 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
42 42 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
43 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 45 import gov.nist.javax.sip.message.SIPResponse;
46 46 import org.slf4j.Logger;
47 47 import org.slf4j.LoggerFactory;
... ... @@ -245,7 +245,7 @@ public class PlayServiceImpl implements IPlayService {
245 245  
246 246 private void talk(MediaServerItem mediaServerItem, Device device, String channelId, String stream,
247 247 ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent,
248   - Runnable timeoutCallback, AudioEvent audioEvent) {
  248 + Runnable timeoutCallback, AudioBroadcastEvent audioEvent) {
249 249  
250 250 String playSsrc = mediaServerItem.getSsrcConfig().getPlaySsrc();
251 251 if (playSsrc == null) {
... ... @@ -982,7 +982,7 @@ public class PlayServiceImpl implements IPlayService {
982 982 SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
983 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 986 if (streamReady) {
987 987 logger.warn("语音广播已经开启: {}", channelId);
988 988 event.call("语音广播已经开启");
... ... @@ -1253,7 +1253,7 @@ public class PlayServiceImpl implements IPlayService {
1253 1253 }
1254 1254  
1255 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 1257 if (device == null || channelId == null) {
1258 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 4 /**
5 5 * @author lin
6 6 */
7   -public interface AudioEvent {
  7 +public interface AudioBroadcastEvent {
8 8 void call(String msg);
9 9 }
... ...