主线合并talk模式

结构优化
648540858 2023-03-20 14:40:17 +08:00
parent 039fbf7e24
commit b3c4636520
5 changed files with 9 additions and 22 deletions

View File

@ -63,8 +63,6 @@ public class AudioBroadcastCatch {
*/ */
private SipTransactionInfo sipTransactionInfo; private SipTransactionInfo sipTransactionInfo;
private MediaServerItem mediaServerItem;
public String getDeviceId() { public String getDeviceId() {
return deviceId; return deviceId;
@ -94,14 +92,6 @@ public class AudioBroadcastCatch {
return sipTransactionInfo; return sipTransactionInfo;
} }
public MediaServerItem getMediaServerItem() {
return mediaServerItem;
}
public void setMediaServerItem(MediaServerItem mediaServerItem) {
this.mediaServerItem = mediaServerItem;
}
public String getApp() { public String getApp() {
return app; return app;
} }

View File

@ -986,22 +986,20 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
logger.info("设备{}请求语音流,地址:{}:{}ssrc{}, {}", requesterId, addressStr, port, ssrc, logger.info("设备{}请求语音流,地址:{}:{}ssrc{}, {}", requesterId, addressStr, port, ssrc,
mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP"); mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP");
MediaServerItem mediaServerItem = audioBroadcastCatch.getMediaServerItem(); MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem();
if (mediaServerItem == null) { if (mediaServerItem == null) {
logger.warn("未找到语音喊话使用的zlm"); logger.warn("未找到语音喊话使用的zlm");
try { try {
responseAck(request, Response.BUSY_HERE); responseAck(request, Response.BUSY_HERE);
} catch (SipException | InvalidArgumentException | ParseException e) { } catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] invite 未找到可用的zlm: {}", e.getMessage()); logger.error("[命令发送失败] invite 未找到可用的zlm: {}", e.getMessage());
playService.stopAudioBroadcast(device.getDeviceId(), audioBroadcastCatch.getChannelId()); playService.stopAudioBroadcast(device.getDeviceId(), broadcastCatch.getChannelId());
} }
return; return;
} }
String addressStr = sdp.getConnection().getAddress();
logger.info("设备{}请求语音流, 收流地址:{}:{}ssrc{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc, logger.info("设备{}请求语音流, 收流地址:{}:{}ssrc{}, {}, 对讲方式:{}", requesterId, addressStr, port, ssrc,
mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue()); mediaTransmissionTCP ? (tcpActive? "TCP主动":"TCP被动") : "UDP", sdp.getSessionName().getValue());
MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem();
SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
device.getDeviceId(), broadcastCatch.getChannelId(), device.getDeviceId(), broadcastCatch.getChannelId(),
mediaTransmissionTCP, false); mediaTransmissionTCP, false);
@ -1025,7 +1023,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
sendRtpItem.setPlatformId(requesterId); sendRtpItem.setPlatformId(requesterId);
sendRtpItem.setStatus(1); sendRtpItem.setStatus(1);
sendRtpItem.setApp(broadcastCatch.getApp()); sendRtpItem.setApp(broadcastCatch.getApp());
sendRtpItem.setStreamId(broadcastCatch.getStream()); sendRtpItem.setStream(broadcastCatch.getStream());
sendRtpItem.setPt(8); sendRtpItem.setPt(8);
sendRtpItem.setUsePs(false); sendRtpItem.setUsePs(false);
sendRtpItem.setRtcp(false); sendRtpItem.setRtcp(false);

View File

@ -12,7 +12,6 @@ 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.gb28181.play.bean.AudioEvent;
import gov.nist.javax.sip.message.SIPResponse; import gov.nist.javax.sip.message.SIPResponse;
import javax.sip.InvalidArgumentException; import javax.sip.InvalidArgumentException;
@ -68,7 +67,7 @@ public interface IPlayService {
void startSendRtpStreamHand(SendRtpItem sendRtpItem, ParentPlatform parentPlatform, void startSendRtpStreamHand(SendRtpItem sendRtpItem, ParentPlatform parentPlatform,
JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader); JSONObject jsonObject, Map<String, Object> param, CallIdHeader callIdHeader);
void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioEvent event); void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioBroadcastEvent event);
void stopTalk(Device device, String channelId, Boolean streamIsReady); void stopTalk(Device device, String channelId, Boolean streamIsReady);
} }

View File

@ -41,7 +41,7 @@ import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult;
import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
import com.genersoft.iot.vmp.vmanager.bean.StreamContent; import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioEvent; import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.AudioBroadcastEvent;
import gov.nist.javax.sip.message.SIPResponse; import gov.nist.javax.sip.message.SIPResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -245,7 +245,7 @@ public class PlayServiceImpl implements IPlayService {
private void talk(MediaServerItem mediaServerItem, Device device, String channelId, String stream, private void talk(MediaServerItem mediaServerItem, Device device, String channelId, String stream,
ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent, ZlmHttpHookSubscribe.Event hookEvent, SipSubscribe.Event errorEvent,
Runnable timeoutCallback, AudioEvent audioEvent) { Runnable timeoutCallback, AudioBroadcastEvent audioEvent) {
String playSsrc = mediaServerItem.getSsrcConfig().getPlaySsrc(); String playSsrc = mediaServerItem.getSsrcConfig().getPlaySsrc();
if (playSsrc == null) { if (playSsrc == null) {
@ -982,7 +982,7 @@ public class PlayServiceImpl implements IPlayService {
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null); SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) { if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
// 查询流是否存在,不存在则认为是异常状态 // 查询流是否存在,不存在则认为是异常状态
Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStreamId()); Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
if (streamReady) { if (streamReady) {
logger.warn("语音广播已经开启: {}", channelId); logger.warn("语音广播已经开启: {}", channelId);
event.call("语音广播已经开启"); event.call("语音广播已经开启");
@ -1253,7 +1253,7 @@ public class PlayServiceImpl implements IPlayService {
} }
@Override @Override
public void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioEvent event) { public void talkCmd(Device device, String channelId, MediaServerItem mediaServerItem, String stream, AudioBroadcastEvent event) {
if (device == null || channelId == null) { if (device == null || channelId == null) {
return; return;
} }

View File

@ -4,6 +4,6 @@ package com.genersoft.iot.vmp.vmanager.gb28181.play.bean;
/** /**
* @author lin * @author lin
*/ */
public interface AudioEvent { public interface AudioBroadcastEvent {
void call(String msg); void call(String msg);
} }