完善支持语音级联
parent
d5f26faf15
commit
db8971302a
|
@ -92,7 +92,7 @@ public class ZLMRTPServerFactory {
|
|||
return result;
|
||||
}
|
||||
|
||||
public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port) {
|
||||
public int createRTPServer(MediaServerItem mediaServerItem, String streamId, int ssrc, Integer port, Boolean onlyAuto) {
|
||||
int result = -1;
|
||||
// 查询此rtp server 是否已经存在
|
||||
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, streamId);
|
||||
|
@ -108,7 +108,7 @@ public class ZLMRTPServerFactory {
|
|||
JSONObject jsonObject = zlmresTfulUtils.closeRtpServer(mediaServerItem, param);
|
||||
if (jsonObject != null ) {
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
return createRTPServer(mediaServerItem, streamId, ssrc, port);
|
||||
return createRTPServer(mediaServerItem, streamId, ssrc, port, onlyAuto);
|
||||
}else {
|
||||
logger.warn("[开启rtpServer], 重启RtpServer错误");
|
||||
}
|
||||
|
@ -131,6 +131,9 @@ public class ZLMRTPServerFactory {
|
|||
param.put("port", port);
|
||||
}
|
||||
param.put("ssrc", ssrc);
|
||||
if (onlyAuto != null) {
|
||||
param.put("only_audio", onlyAuto?"1":"0");
|
||||
}
|
||||
JSONObject openRtpServerResultJson = zlmresTfulUtils.openRtpServer(mediaServerItem, param);
|
||||
logger.info(JSONObject.toJSONString(openRtpServerResultJson));
|
||||
if (openRtpServerResultJson != null) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface IMediaServerService {
|
|||
|
||||
SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback);
|
||||
|
||||
SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback, Integer port);
|
||||
SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback, Integer port, Boolean onlyAuto);
|
||||
|
||||
void closeRTPServer(MediaServerItem mediaServerItem, String streamId);
|
||||
|
||||
|
|
|
@ -1,16 +1,5 @@
|
|||
package com.genersoft.iot.vmp.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMRunner;
|
||||
import com.genersoft.iot.vmp.service.IStreamProxyService;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
|
@ -39,8 +28,6 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
|||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -134,7 +121,8 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String presetSsrc, boolean ssrcCheck, boolean isPlayback, Integer port) {
|
||||
public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String presetSsrc, boolean ssrcCheck,
|
||||
boolean isPlayback, Integer port, Boolean onlyAuto) {
|
||||
if (mediaServerItem == null || mediaServerItem.getId() == null) {
|
||||
logger.info("[openRTPServer] 失败, mediaServerItem == null || mediaServerItem.getId() == null");
|
||||
return null;
|
||||
|
@ -163,7 +151,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
int rtpServerPort;
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port);
|
||||
rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port, onlyAuto);
|
||||
} else {
|
||||
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||
}
|
||||
|
@ -174,7 +162,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
|
||||
@Override
|
||||
public SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback) {
|
||||
return openRTPServer(mediaServerItem, streamId, ssrc, ssrcCheck, isPlayback, null);
|
||||
return openRTPServer(mediaServerItem, streamId, ssrc, ssrcCheck, isPlayback, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -367,7 +367,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
}
|
||||
// 默认不进行SSRC校验, TODO 后续可改为配置
|
||||
boolean ssrcCheck = false;
|
||||
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrcCheck, false);
|
||||
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, ssrcCheck, false, null, true);
|
||||
if (ssrcInfo == null || ssrcInfo.getPort() < 0) {
|
||||
logger.info("[国标级联] 发起语音喊话 开启端口监听失败, platform: {}, channel: {}", platform.getServerGBId(), channelId);
|
||||
errorEvent.response(new SipSubscribe.EventResult(-1, "端口监听失败"));
|
||||
|
@ -449,7 +449,8 @@ public class PlatformServiceImpl implements IPlatformService {
|
|||
// 关闭rtp server
|
||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||
// 重新开启ssrc server
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, false, false, ssrcInfo.getPort());
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, false, false, ssrcInfo.getPort(), true);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -535,7 +535,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
// 关闭rtp server
|
||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||
// 重新开启ssrc server
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false, ssrcInfo.getPort());
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), false, ssrcInfo.getPort(), false);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -776,7 +776,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
// 关闭rtp server
|
||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||
// 重新开启ssrc server
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), true, ssrcInfo.getPort());
|
||||
mediaServerService.openRTPServer(mediaServerItem, ssrcInfo.getStream(), ssrcInResponse, device.isSsrcCheck(), true, ssrcInfo.getPort(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
|
||||
<property name="LOG_HOME" value="logs" />
|
||||
|
||||
<substitutionProperty name="log.pattern" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr(%-80.80logger{79}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||
<substitutionProperty name="log.pattern" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(---){faint} %clr(%-1.30logger{0}){cyan} %clr(:){faint} %m%n%wEx"/>
|
||||
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
|
|
Loading…
Reference in New Issue