支持使用abl接收国标流

pull/1411/head
648540858 2024-04-02 00:05:09 +08:00
parent b78769f997
commit 8b90fade9e
22 changed files with 1964 additions and 201 deletions

View File

@ -195,8 +195,7 @@ public class StreamInfo implements Serializable, Cloneable{
}
}
public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
public void setFlv(String host, int port, int sslPort, String file) {
if (port > 0) {
this.flv = new StreamURL("http", host, port, file);
}
@ -207,6 +206,15 @@ public class StreamInfo implements Serializable, Cloneable{
}
}
public void setWsFlv(String host, int port, int sslPort, String file) {
if (port > 0) {
this.ws_flv = new StreamURL("ws", host, port, file);
}
if (sslPort > 0) {
this.wss_flv = new StreamURL("wss", host, sslPort, file);
}
}
public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
if (port > 0) {

View File

@ -42,12 +42,24 @@ public class MediaConfig{
@Value("${media.stream-ip:${media.ip}}")
private String streamIp;
@Value("${media.http-port}")
@Value("${media.http-port:0}")
private Integer httpPort;
@Value("${media.flv-port:0}")
private Integer flvPort = 0;
@Value("${media.ws-flv-port:0}")
private Integer wsFlvPort = 0;
@Value("${media.http-ssl-port:0}")
private Integer httpSSlPort = 0;
@Value("${media.flv-ssl-port:0}")
private Integer flvSSlPort = 0;
@Value("${media.ws-flv-ssl-port:0}")
private Integer wsFlvSSlPort = 0;
@Value("${media.rtmp-port:0}")
private Integer rtmpPort = 0;
@ -208,7 +220,11 @@ public class MediaConfig{
mediaServerItem.setSdpIp(getSdpIp());
mediaServerItem.setStreamIp(getStreamIp());
mediaServerItem.setHttpPort(httpPort);
mediaServerItem.setFlvPort(flvPort);
mediaServerItem.setWsFlvPort(wsFlvPort);
mediaServerItem.setHttpSSlPort(httpSSlPort);
mediaServerItem.setFlvSSLPort(flvSSlPort);
mediaServerItem.setWsFlvSSLPort(wsFlvSSlPort);
mediaServerItem.setRtmpPort(rtmpPort);
mediaServerItem.setRtmpSSlPort(rtmpSSlPort);
mediaServerItem.setRtpProxyPort(getRtpProxyPort());

View File

@ -500,7 +500,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
String startTimeStr = DateUtil.urlFormatter.format(start);
String endTimeStr = DateUtil.urlFormatter.format(end);
String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr;
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0,false, false, device.getStreamModeForParam());
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0,false,!channel.isHasAudio(), false, device.getStreamModeForParam());
sendRtpItem.setStream(stream);
// 写入redis 超时时回复
redisCatchStorage.updateSendRTPSever(sendRtpItem);
@ -530,7 +530,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
sendRtpItem.setPlayType(InviteStreamType.DOWNLOAD);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,!channel.isHasAudio(), false, device.getStreamModeForParam());
sendRtpItem.setStream(ssrcInfo.getStream());
// 写入redis 超时时回复
redisCatchStorage.updateSendRTPSever(sendRtpItem);

View File

@ -6,6 +6,7 @@ import com.genersoft.iot.vmp.media.bean.MediaInfo;
import com.genersoft.iot.vmp.media.service.IMediaNodeServerService;
import com.genersoft.iot.vmp.media.bean.MediaServer;
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@ -14,9 +15,12 @@ import java.util.Map;
@Service("abl")
public class ABLMediaNodeServerService implements IMediaNodeServerService {
@Autowired
private ABLRESTfulUtils ablresTfulUtils;
@Override
public int createRTPServer(MediaServer mediaServerItem, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) {
return 0;
public int createRTPServer(MediaServer mediaServer, String stream, long ssrc, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode) {
return ablresTfulUtils.openRtpServer(mediaServer, "rtp", stream, 96, port, tcpMode, disableAudio?1:0);
}
@Override

View File

@ -212,15 +212,24 @@ public class ABLMediaServerStatusManger {
// if (mediaServerItem.getHttpSSlPort() == 0) {
// mediaServerItem.setHttpSSlPort(ablServerConfig.getHttpSSLport());
// }
if (mediaServerItem.getRtmpPort() == 0) {
if (mediaServerItem.getRtmpPort() == 0 && ablServerConfig.getRtmpPort() != null) {
mediaServerItem.setRtmpPort(ablServerConfig.getRtmpPort());
}
// if (mediaServerItem.getRtmpSSlPort() == 0) {
// mediaServerItem.setRtmpSSlPort(ablServerConfig.getRtmpSslPort());
// }
if (mediaServerItem.getRtspPort() == 0) {
if (mediaServerItem.getRtspPort() == 0 && ablServerConfig.getRtspPort() != null) {
mediaServerItem.setRtspPort(ablServerConfig.getRtspPort());
}
if (mediaServerItem.getFlvPort() == 0 && ablServerConfig.getHttpFlvPort() != null) {
mediaServerItem.setFlvPort(ablServerConfig.getHttpFlvPort());
}
if (mediaServerItem.getWsFlvPort() == 0 && ablServerConfig.getWsPort() != null) {
mediaServerItem.setWsFlvPort(ablServerConfig.getWsPort());
}
if (mediaServerItem.getRtpProxyPort() == 0 && ablServerConfig.getPsTsRecvPort() != null) {
mediaServerItem.setRtpProxyPort(ablServerConfig.getPsTsRecvPort());
}
// if (mediaServerItem.getRtspSSLPort() == 0) {
// mediaServerItem.setRtspSSLPort(ablServerConfig.getRtspSSlport());
// }

View File

@ -270,67 +270,38 @@ public class ABLRESTfulUtils {
}
}
public JSONObject getMediaList(MediaServer mediaServerItem, String app, String stream, String schema, RequestCallback callback){
public Integer openRtpServer(MediaServer mediaServer, String app, String stream, int payload, Integer port, Integer tcpMode, Integer disableAudio) {
Map<String, Object> param = new HashMap<>();
if (app != null) {
param.put("app",app);
param.put("vhost", "_defaultVhost_");
param.put("app", app);
param.put("stream_id", stream);
param.put("payload", payload);
if (port != null) {
param.put("port", port);
}
if (stream != null) {
param.put("stream",stream);
if (tcpMode != null) {
param.put("enable_tcp", tcpMode);
}
if (schema != null) {
param.put("schema",schema);
if (disableAudio != null) {
param.put("disableAudio", disableAudio);
}
JSONObject jsonObject = sendPost(mediaServer, "openRtpServer", param, null);
if (jsonObject.getInteger("code") == 0) {
return jsonObject.getInteger("port");
}else {
return 0;
}
param.put("vhost","__defaultVhost__");
return sendPost(mediaServerItem, "getMediaList",param, callback);
}
public JSONObject getMediaList(MediaServer mediaServerItem, String app, String stream){
return getMediaList(mediaServerItem, app, stream,null, null);
}
public JSONObject getMediaList(MediaServer mediaServerItem, RequestCallback callback){
return sendPost(mediaServerItem, "getMediaList",null, callback);
}
public JSONObject getMediaInfo(MediaServer mediaServerItem, String app, String schema, String stream){
public JSONObject closeStreams(MediaServer mediaServerItem, String app, String stream) {
Map<String, Object> param = new HashMap<>();
param.put("app",app);
param.put("schema",schema);
param.put("stream",stream);
param.put("vhost","__defaultVhost__");
return sendPost(mediaServerItem, "getMediaInfo",param, null);
}
public JSONObject getRtpInfo(MediaServer mediaServerItem, String stream_id){
Map<String, Object> param = new HashMap<>();
param.put("stream_id",stream_id);
return sendPost(mediaServerItem, "getRtpInfo",param, null);
}
public JSONObject addFFmpegSource(MediaServer mediaServerItem, String src_url, String dst_url, Integer timeout_ms,
boolean enable_audio, boolean enable_mp4, String ffmpeg_cmd_key){
logger.info(src_url);
logger.info(dst_url);
Map<String, Object> param = new HashMap<>();
param.put("src_url", src_url);
param.put("dst_url", dst_url);
param.put("timeout_ms", timeout_ms);
param.put("enable_mp4", enable_mp4);
param.put("ffmpeg_cmd_key", ffmpeg_cmd_key);
return sendPost(mediaServerItem, "addFFmpegSource",param, null);
}
public JSONObject delFFmpegSource(MediaServer mediaServerItem, String key){
Map<String, Object> param = new HashMap<>();
param.put("key", key);
return sendPost(mediaServerItem, "delFFmpegSource",param, null);
}
public JSONObject delStreamProxy(MediaServer mediaServerItem, String key){
Map<String, Object> param = new HashMap<>();
param.put("key", key);
return sendPost(mediaServerItem, "delStreamProxy",param, null);
param.put("vhost", "__defaultVhost__");
param.put("app", app);
param.put("stream", stream);
param.put("force", 1);
return sendPost(mediaServerItem, "close_streams",param, null);
}
public JSONObject getServerConfig(MediaServer mediaServerItem){
@ -343,116 +314,4 @@ public class ABLRESTfulUtils {
param.put("value", value);
return sendGet(mediaServerItem,"setConfigParamValue", param);
}
public JSONObject openRtpServer(MediaServer mediaServerItem, Map<String, Object> param){
return sendPost(mediaServerItem, "openRtpServer",param, null);
}
public JSONObject closeRtpServer(MediaServer mediaServerItem, Map<String, Object> param) {
return sendPost(mediaServerItem, "closeRtpServer",param, null);
}
public void closeRtpServer(MediaServer mediaServerItem, Map<String, Object> param, RequestCallback callback) {
sendPost(mediaServerItem, "closeRtpServer",param, callback);
}
public JSONObject listRtpServer(MediaServer mediaServerItem) {
return sendPost(mediaServerItem, "listRtpServer",null, null);
}
public JSONObject startSendRtp(MediaServer mediaServerItem, Map<String, Object> param) {
return sendPost(mediaServerItem, "startSendRtp",param, null);
}
public JSONObject startSendRtpPassive(MediaServer mediaServerItem, Map<String, Object> param) {
return sendPost(mediaServerItem, "startSendRtpPassive",param, null);
}
public JSONObject startSendRtpPassive(MediaServer mediaServerItem, Map<String, Object> param, RequestCallback callback) {
return sendPost(mediaServerItem, "startSendRtpPassive",param, callback);
}
public JSONObject stopSendRtp(MediaServer mediaServerItem, Map<String, Object> param) {
return sendPost(mediaServerItem, "stopSendRtp",param, null);
}
public JSONObject restartServer(MediaServer mediaServerItem) {
return sendPost(mediaServerItem, "restartServer",null, null);
}
public JSONObject addStreamProxy(MediaServer mediaServerItem, String app, String stream, String url, boolean enable_audio, boolean enable_mp4, String rtp_type) {
Map<String, Object> param = new HashMap<>();
param.put("vhost", "__defaultVhost__");
param.put("app", app);
param.put("stream", stream);
param.put("url", url);
param.put("enable_mp4", enable_mp4?1:0);
param.put("enable_audio", enable_audio?1:0);
param.put("rtp_type", rtp_type);
return sendPost(mediaServerItem, "addStreamProxy",param, null, 20);
}
public JSONObject closeStreams(MediaServer mediaServerItem, String app, String stream) {
Map<String, Object> param = new HashMap<>();
param.put("vhost", "__defaultVhost__");
param.put("app", app);
param.put("stream", stream);
param.put("force", 1);
return sendPost(mediaServerItem, "close_streams",param, null);
}
public JSONObject getAllSession(MediaServer mediaServerItem) {
return sendPost(mediaServerItem, "getAllSession",null, null);
}
public void kickSessions(MediaServer mediaServerItem, String localPortSStr) {
Map<String, Object> param = new HashMap<>();
param.put("local_port", localPortSStr);
sendPost(mediaServerItem, "kick_sessions",param, null);
}
public void getSnap(MediaServer mediaServerItem, String streamUrl, int timeout_sec, int expire_sec, String targetPath, String fileName) {
Map<String, Object> param = new HashMap<>(3);
param.put("url", streamUrl);
param.put("timeout_sec", timeout_sec);
param.put("expire_sec", expire_sec);
sendGetForImg(mediaServerItem, "getSnap", param, targetPath, fileName);
}
public JSONObject pauseRtpCheck(MediaServer mediaServerItem, String streamId) {
Map<String, Object> param = new HashMap<>(1);
param.put("stream_id", streamId);
return sendPost(mediaServerItem, "pauseRtpCheck",param, null);
}
public JSONObject resumeRtpCheck(MediaServer mediaServerItem, String streamId) {
Map<String, Object> param = new HashMap<>(1);
param.put("stream_id", streamId);
return sendPost(mediaServerItem, "resumeRtpCheck",param, null);
}
public JSONObject connectRtpServer(MediaServer mediaServerItem, String dst_url, int dst_port, String stream_id) {
Map<String, Object> param = new HashMap<>(1);
param.put("dst_url", dst_url);
param.put("dst_port", dst_port);
param.put("stream_id", stream_id);
return sendPost(mediaServerItem, "connectRtpServer",param, null);
}
public JSONObject updateRtpServerSSRC(MediaServer mediaServerItem, String streamId, String ssrc) {
Map<String, Object> param = new HashMap<>(1);
param.put("ssrc", ssrc);
param.put("stream_id", streamId);
return sendPost(mediaServerItem, "updateRtpServerSSRC",param, null);
}
public JSONObject deleteRecordDirectory(MediaServer mediaServerItem, String app, String stream, String date, String fileName) {
Map<String, Object> param = new HashMap<>(1);
param.put("vhost", "__defaultVhost__");
param.put("app", app);
param.put("stream", stream);
param.put("period", date);
param.put("name", fileName);
return sendPost(mediaServerItem, "deleteRecordDirectory",param, null);
}
}

View File

@ -21,7 +21,7 @@ public class ABLHookParam {
/**
*
*/
private String networkType;
private Integer networkType;
public String getMediaServerId() {
return mediaServerId;
@ -55,11 +55,11 @@ public class ABLHookParam {
this.key = key;
}
public String getNetworkType() {
public Integer getNetworkType() {
return networkType;
}
public void setNetworkType(String networkType) {
public void setNetworkType(Integer networkType) {
this.networkType = networkType;
}
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.media.abl.bean.hook.OnStreamArriveABLHookParam;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
import com.genersoft.iot.vmp.media.zlm.dto.hook.OriginType;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
@ -186,6 +187,24 @@ public class MediaInfo {
mediaInfo.setReaderCount(param.getReaderCount());
mediaInfo.setOnline(true);
mediaInfo.setVideoCodec(param.getVideoCodec());
switch (param.getNetworkType()) {
case 21:
mediaInfo.setOriginType(OriginType.RTMP_PUSH.ordinal());
break;
case 23:
mediaInfo.setOriginType(OriginType.RTSP_PUSH.ordinal());
break;
case 30:
case 31:
case 32:
case 33:
mediaInfo.setOriginType(OriginType.PULL.ordinal());
break;
default:
mediaInfo.setOriginType(OriginType.UNKNOWN.ordinal());
break;
}
mediaInfo.setWidth(param.getWidth());
mediaInfo.setHeight(param.getHeight());
mediaInfo.setAudioCodec(param.getAudioCodec());

View File

@ -32,6 +32,18 @@ public class MediaServer {
@Schema(description = "RTMP端口")
private int rtmpPort;
@Schema(description = "flv端口")
private int flvPort;
@Schema(description = "https-flv端口")
private int flvSSLPort;
@Schema(description = "ws-flv端口")
private int wsFlvPort;
@Schema(description = "wss-flv端口")
private int wsFlvSSLPort;
@Schema(description = "RTMPS端口")
private int rtmpSSlPort;
@ -98,7 +110,11 @@ public class MediaServer {
sdpIp = ObjectUtils.isEmpty(zlmServerConfig.getSdpIp())? zlmServerConfig.getIp(): zlmServerConfig.getSdpIp();
streamIp = ObjectUtils.isEmpty(zlmServerConfig.getStreamIp())? zlmServerConfig.getIp(): zlmServerConfig.getStreamIp();
httpPort = zlmServerConfig.getHttpPort();
flvPort = zlmServerConfig.getHttpPort();
wsFlvPort = zlmServerConfig.getHttpPort();
httpSSlPort = zlmServerConfig.getHttpSSLport();
flvSSLPort = zlmServerConfig.getHttpSSLport();
wsFlvSSLPort = zlmServerConfig.getHttpSSLport();
rtmpPort = zlmServerConfig.getRtmpPort();
rtmpSSlPort = zlmServerConfig.getRtmpSslPort();
rtpProxyPort = zlmServerConfig.getRtpProxyPort();
@ -328,4 +344,36 @@ public class MediaServer {
public void setType(String type) {
this.type = type;
}
public int getFlvPort() {
return flvPort;
}
public void setFlvPort(int flvPort) {
this.flvPort = flvPort;
}
public int getFlvSSLPort() {
return flvSSLPort;
}
public void setFlvSSLPort(int flvSSLPort) {
this.flvSSLPort = flvSSLPort;
}
public int getWsFlvPort() {
return wsFlvPort;
}
public void setWsFlvPort(int wsFlvPort) {
this.wsFlvPort = wsFlvPort;
}
public int getWsFlvSSLPort() {
return wsFlvSSLPort;
}
public void setWsFlvSSLPort(int wsFlvSSLPort) {
this.wsFlvSSLPort = wsFlvSSLPort;
}
}

View File

@ -35,7 +35,7 @@ public class HookSubscribe {
@Async("taskExecutor")
@EventListener
public void onApplicationEvent(MediaArrivalEvent event) {
if ("rtsp".equals(event.getSchema())) {
if (event.getSchema() == null || "rtsp".equals(event.getSchema())) {
sendNotify(HookType.on_media_arrival, event);
}
@ -47,7 +47,7 @@ public class HookSubscribe {
@Async("taskExecutor")
@EventListener
public void onApplicationEvent(MediaDepartureEvent event) {
if ("rtsp".equals(event.getSchema())) {
if (event.getSchema() == null || "rtsp".equals(event.getSchema())) {
sendNotify(HookType.on_media_departure, event);
}

View File

@ -10,7 +10,7 @@ import java.util.List;
import java.util.Map;
public interface IMediaNodeServerService {
int createRTPServer(MediaServer mediaServer, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode);
int createRTPServer(MediaServer mediaServer, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode);
void closeRtpServer(MediaServer mediaServer, String streamId);

View File

@ -33,9 +33,7 @@ public interface IMediaServerService {
void updateVmServer(List<MediaServer> mediaServerItemList);
SSRCInfo openRTPServer(MediaServer mediaServerItem, String streamId, String presetSsrc, boolean ssrcCheck,
boolean isPlayback, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode);
SSRCInfo openRTPServer(MediaServer mediaServerItem, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback, Integer port, Boolean onlyAuto);
boolean isPlayback, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode);
void closeRTPServer(MediaServer mediaServerItem, String streamId);

View File

@ -132,7 +132,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
@Override
public SSRCInfo openRTPServer(MediaServer mediaServer, String streamId, String presetSsrc, boolean ssrcCheck,
boolean isPlayback, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) {
boolean isPlayback, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode) {
if (mediaServer == null || mediaServer.getId() == null) {
logger.info("[openRTPServer] 失败, mediaServer == null || mediaServer.getId() == null");
return null;
@ -163,19 +163,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
logger.info("[openRTPServer] 失败, mediaServer的类型 {},未找到对应的实现类", mediaServer.getType());
return null;
}
rtpServerPort = mediaNodeServerService.createRTPServer(mediaServer, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, reUsePort, tcpMode);
rtpServerPort = mediaNodeServerService.createRTPServer(mediaServer, streamId, ssrcCheck ? Long.parseLong(ssrc) : 0, port, onlyAuto, disableAudio, reUsePort, tcpMode);
} else {
rtpServerPort = mediaServer.getRtpProxyPort();
}
return new SSRCInfo(rtpServerPort, ssrc, streamId);
}
@Override
public SSRCInfo openRTPServer(MediaServer mediaServer, String streamId, String ssrc, boolean ssrcCheck, boolean isPlayback, Integer port, Boolean onlyAuto) {
return openRTPServer(mediaServer, streamId, ssrc, ssrcCheck, isPlayback, port, onlyAuto, null, 0);
}
@Override
public void closeRTPServer(MediaServer mediaServer, String streamId) {
if (mediaServer == null) {
@ -770,7 +764,18 @@ public class MediaServerServiceImpl implements IMediaServerService {
String callIdParam = ObjectUtils.isEmpty(callId)?"":"?callId=" + callId;
streamInfoResult.setRtmp(addr, mediaServer.getRtmpPort(),mediaServer.getRtmpSSlPort(), app, stream, callIdParam);
streamInfoResult.setRtsp(addr, mediaServer.getRtspPort(),mediaServer.getRtspSSLPort(), app, stream, callIdParam);
streamInfoResult.setFlv(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
if ("abl".equals(mediaServer.getType())) {
String flvFile = String.format("%s/%s.flv%s", app, stream, callIdParam);
streamInfoResult.setFlv(addr, mediaServer.getFlvPort(),mediaServer.getFlvSSLPort(), flvFile);
streamInfoResult.setWsFlv(addr, mediaServer.getWsFlvPort(),mediaServer.getWsFlvSSLPort(), flvFile);
}else {
String flvFile = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
streamInfoResult.setFlv(addr, mediaServer.getFlvPort(),mediaServer.getFlvSSLPort(), flvFile);
streamInfoResult.setWsFlv(addr, mediaServer.getWsFlvPort(),mediaServer.getWsFlvSSLPort(), flvFile);
}
streamInfoResult.setFmp4(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
streamInfoResult.setHls(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
streamInfoResult.setTs(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);

View File

@ -39,7 +39,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
private String sipIp;
@Override
public int createRTPServer(MediaServer mediaServer, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean reUsePort, Integer tcpMode) {
public int createRTPServer(MediaServer mediaServer, String streamId, long ssrc, Integer port, Boolean onlyAuto, Boolean disableAudio, Boolean reUsePort, Integer tcpMode) {
return zlmServerFactory.createRTPServer(mediaServer, streamId, ssrc, port, onlyAuto, reUsePort, tcpMode);
}
@ -178,7 +178,9 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
String callIdParam = ObjectUtils.isEmpty(callId)?"":"?callId=" + callId;
streamInfoResult.setRtmp(addr, mediaServer.getRtmpPort(),mediaServer.getRtmpSSlPort(), app, stream, callIdParam);
streamInfoResult.setRtsp(addr, mediaServer.getRtspPort(),mediaServer.getRtspSSLPort(), app, stream, callIdParam);
streamInfoResult.setFlv(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
String flvFile = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
streamInfoResult.setFlv(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), flvFile);
streamInfoResult.setWsFlv(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), flvFile);
streamInfoResult.setFmp4(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
streamInfoResult.setHls(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);
streamInfoResult.setTs(addr, mediaServer.getHttpPort(),mediaServer.getHttpSSlPort(), app, stream, callIdParam);

View File

@ -542,7 +542,7 @@ public class PlatformServiceImpl implements IPlatformService {
} else {
tcpMode = 0;
}
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, ssrcCheck, false, null, true, false, tcpMode);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, ssrcCheck, false, null, true, false, false, tcpMode);
if (ssrcInfo == null || ssrcInfo.getPort() < 0) {
logger.info("[国标级联] 发起语音喊话 开启端口监听失败, platform: {}, channel {}", platform.getServerGBId(), channelId);
SipSubscribe.EventResult<Object> eventResult = new SipSubscribe.EventResult<>();

View File

@ -259,7 +259,7 @@ public class PlayServiceImpl implements IPlayService {
);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(event.getMediaServer(), event.getStream(), null,
device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
device.isSsrcCheck(), true, 0, false, !deviceChannel.isHasAudio(), false, device.getStreamModeForParam());
playBack(event.getMediaServer(), ssrcInfo, deviceId, channelId, startTime, endTime, null);
}
}
@ -321,7 +321,7 @@ public class PlayServiceImpl implements IPlayService {
}
}
String streamId = String.format("%s_%s", device.getDeviceId(), channelId);
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(), false, 0, false, false, device.getStreamModeForParam());
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, ssrc, device.isSsrcCheck(), false, 0, false, !channel.isHasAudio(), false, device.getStreamModeForParam());
if (ssrcInfo == null) {
callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null);
inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
@ -762,6 +762,12 @@ public class PlayServiceImpl implements IPlayService {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
}
DeviceChannel channel = channelService.getOne(deviceId, channelId);
if (channel == null) {
logger.warn("[录像回放] 未找到通道 deviceId: {},channelId:{}", deviceId, channelId);
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道:" + channelId);
}
MediaServer newMediaServerItem = getNewMediaServerItem(device);
if (device.getStreamMode().equalsIgnoreCase("TCP-ACTIVE") && ! newMediaServerItem.isRtpEnable()) {
logger.warn("[录像回放] 单端口收流时不支持TCP主动方式收流 deviceId: {},channelId:{}", deviceId, channelId);
@ -774,7 +780,7 @@ public class PlayServiceImpl implements IPlayService {
.replace(":", "")
.replace(" ", "");
String stream = deviceId + "_" + channelId + "_" + startTimeStr + "_" + endTimeTimeStr;
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, !channel.isHasAudio(), false, device.getStreamModeForParam());
playBack(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, callback);
}
@ -959,6 +965,10 @@ public class PlayServiceImpl implements IPlayService {
if (device == null) {
return;
}
DeviceChannel channel = channelService.getOne(deviceId, channelId);
if (channel == null) {
return;
}
MediaServer newMediaServerItem = this.getNewMediaServerItem(device);
if (newMediaServerItem == null) {
callback.run(InviteErrorCode.ERROR_FOR_ASSIST_NOT_READY.getCode(),
@ -967,7 +977,7 @@ public class PlayServiceImpl implements IPlayService {
return;
}
// 录像下载不使用固定流地址,固定流地址会导致如果开始时间与结束时间一致时文件错误的叠加在一起
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,false, device.getStreamModeForParam());
SSRCInfo ssrcInfo = mediaServerService.openRTPServer(newMediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,!channel.isHasAudio(), false, device.getStreamModeForParam());
download(newMediaServerItem, ssrcInfo, deviceId, channelId, startTime, endTime, downloadSpeed, callback);
}

View File

@ -24,6 +24,10 @@ public interface MediaServerMapper {
"rtmp_ssl_port,"+
"rtp_proxy_port,"+
"rtsp_port,"+
"flv_port," +
"flv_ssl_port," +
"ws_flv_port," +
"ws_flv_ssl__port," +
"rtsp_ssl_port,"+
"auto_config,"+
"secret,"+
@ -51,6 +55,10 @@ public interface MediaServerMapper {
"#{rtmpSSlPort}, " +
"#{rtpProxyPort}, " +
"#{rtspPort}, " +
"#{flvPort}, " +
"#{flvSSLPort}, " +
"#{wsFlvPort}, " +
"#{wsFlvSSLPort}, " +
"#{rtspSSLPort}, " +
"#{autoConfig}, " +
"#{secret}, " +
@ -81,6 +89,10 @@ public interface MediaServerMapper {
"<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
"<if test=\"flvPort != null\">, flv_port=#{flvPort}</if>" +
"<if test=\"flvSSLPort != null\">, flv_ssl_port=#{flvSSLPort}</if>" +
"<if test=\"wsFlvPort != null\">, ws_flv_port=#{wsFlvPort}</if>" +
"<if test=\"wsFlvSSLPort != null\">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>" +
"<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +
@ -108,6 +120,10 @@ public interface MediaServerMapper {
"<if test=\"rtpProxyPort != null\">, rtp_proxy_port=#{rtpProxyPort}</if>" +
"<if test=\"rtspPort != null\">, rtsp_port=#{rtspPort}</if>" +
"<if test=\"rtspSSLPort != null\">, rtsp_ssl_port=#{rtspSSLPort}</if>" +
"<if test=\"flvPort != null\">, flv_port=#{flvPort}</if>" +
"<if test=\"flvSSLPort != null\">, flv_ssl_port=#{flvSSLPort}</if>" +
"<if test=\"wsFlvPort != null\">, ws_flv_port=#{wsFlvPort}</if>" +
"<if test=\"wsFlvSSLPort != null\">, ws_flv_ssl_port=#{wsFlvSSLPort}</if>" +
"<if test=\"autoConfig != null\">, auto_config=#{autoConfig}</if>" +
"<if test=\"rtpEnable != null\">, rtp_enable=#{rtpEnable}</if>" +
"<if test=\"rtpPortRange != null\">, rtp_port_range=#{rtpPortRange}</if>" +

View File

@ -155,6 +155,10 @@ create table wvp_media_server (
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',

View File

@ -155,6 +155,10 @@ create table wvp_media_server (
rtp_proxy_port integer,
rtsp_port integer,
rtsp_ssl_port integer,
flv_port integer,
flv_ssl_port integer,
ws_flv_port integer,
ws_flv_ssl_port integer,
auto_config bool default false,
secret character varying(50),
type character varying(50) default 'zlm',

View File

@ -1,2 +1,11 @@
alter table wvp_media_server
add type character varying(50) default 'zlm';
alter table wvp_media_server
add flv_port integer;
alter table wvp_media_server
add flv_ssl_port integer;
alter table wvp_media_server
add ws_flv_port integer;
alter table wvp_media_server
add ws_flv_ssl_port integer;

View File

@ -1,2 +1,11 @@
alter table wvp_media_server
add type character varying(50) default 'zlm',;
add type character varying(50) default 'zlm';
alter table wvp_media_server
add flv_port integer;
alter table wvp_media_server
add flv_ssl_port integer;
alter table wvp_media_server
add ws_flv_port integer;
alter table wvp_media_server
add ws_flv_ssl_port integer;