[1078] 支持语音对讲 中心广播模式
This commit is contained in:
@@ -362,6 +362,12 @@ public class ABLMediaNodeServerService implements IMediaNodeServerService {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer startSendRtpTalk(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
logger.warn("[abl-startSendRtpTalk] 未实现");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpStream(MediaServer mediaServer, SendRtpInfo sendRtpItem) {
|
||||
logger.warn("[abl-startSendRtpStream] 未实现");
|
||||
|
||||
@@ -66,6 +66,8 @@ public interface IMediaNodeServerService {
|
||||
|
||||
void startSendRtpStream(MediaServer mediaServer, SendRtpInfo sendRtpItem);
|
||||
|
||||
Integer startSendRtpTalk(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
|
||||
Long updateDownloadProcess(MediaServer mediaServer, String app, String stream);
|
||||
|
||||
void startProxy(MediaServer mediaServer, StreamProxy streamProxy);
|
||||
|
||||
@@ -148,6 +148,8 @@ public interface IMediaServerService {
|
||||
|
||||
Integer startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
|
||||
Integer startSendRtpTalk(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
|
||||
void startSendRtp(MediaServer mediaServer, SendRtpInfo sendRtpItem);
|
||||
|
||||
MediaServer getMediaServerByAppAndStream(String app, String stream);
|
||||
|
||||
@@ -936,6 +936,16 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
return mediaNodeServerService.startSendRtpPassive(mediaServer, sendRtpItem, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer startSendRtpTalk(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||
if (mediaNodeServerService == null) {
|
||||
log.info("[startSendRtpPassive] 失败, mediaServer的类型: {},未找到对应的实现类", mediaServer.getType());
|
||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到mediaServer对应的实现类");
|
||||
}
|
||||
return mediaNodeServerService.startSendRtpTalk(mediaServer, sendRtpItem, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtp(MediaServer mediaServer, SendRtpInfo sendRtpItem) {
|
||||
IMediaNodeServerService mediaNodeServerService = nodeServerServiceMap.get(mediaServer.getType());
|
||||
|
||||
@@ -425,6 +425,29 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
||||
log.info("[推流结果]:{} ,参数: {}",jsonObject, JSONObject.toJSONString(param));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer startSendRtpTalk(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
param.put("stream", sendRtpItem.getStream());
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
param.put("pt", sendRtpItem.getPt());
|
||||
param.put("type", sendRtpItem.isUsePs() ? "1" : "0");
|
||||
param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0");
|
||||
param.put("recv_stream_id", sendRtpItem.getReceiveStream());
|
||||
|
||||
JSONObject jsonObject = zlmServerFactory.startSendRtpTalk(mediaServer, param, null);
|
||||
if (jsonObject == null || jsonObject.getInteger("code") != 0 ) {
|
||||
log.error("启动监听TCP被动推流失败: {}, 参数:{}", jsonObject.getString("msg"), JSON.toJSONString(param));
|
||||
throw new ControllerException(jsonObject.getInteger("code"), jsonObject.getString("msg"));
|
||||
}
|
||||
log.info("调用ZLM-TCP被动推流接口, 结果: {}", jsonObject);
|
||||
log.info("启动监听TCP被动推流成功[ {}/{} ],{}->{}:{}, " , sendRtpItem.getApp(), sendRtpItem.getStream(),
|
||||
jsonObject.getString("local_port"), param.get("dst_url"), param.get("dst_port"));
|
||||
return jsonObject.getInteger("local_port");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long updateDownloadProcess(MediaServer mediaServer, String app, String stream) {
|
||||
MediaInfo mediaInfo = getMediaInfo(mediaServer, app, stream);
|
||||
|
||||
@@ -331,6 +331,10 @@ public class ZLMRESTfulUtils {
|
||||
return sendPost(mediaServerItem, "startSendRtpPassive",param, callback);
|
||||
}
|
||||
|
||||
public JSONObject startSendRtpTalk(MediaServer mediaServerItem, Map<String, Object> param, RequestCallback callback) {
|
||||
return sendPost(mediaServerItem, "startSendRtpTalk",param, callback);
|
||||
}
|
||||
|
||||
public JSONObject stopSendRtp(MediaServer mediaServerItem, Map<String, Object> param) {
|
||||
return sendPost(mediaServerItem, "stopSendRtp",param, null);
|
||||
}
|
||||
|
||||
@@ -162,10 +162,14 @@ public class ZLMServerFactory {
|
||||
return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param);
|
||||
}
|
||||
|
||||
public JSONObject startSendRtpPassive(MediaServer mediaServerItem, Map<String, Object>param, ZLMRESTfulUtils.RequestCallback callback) {
|
||||
public JSONObject startSendRtpPassive(MediaServer mediaServerItem, Map<String, Object> param, ZLMRESTfulUtils.RequestCallback callback) {
|
||||
return zlmresTfulUtils.startSendRtpPassive(mediaServerItem, param, callback);
|
||||
}
|
||||
|
||||
public JSONObject startSendRtpTalk(MediaServer mediaServer, Map<String, Object> param, ZLMRESTfulUtils.RequestCallback callback) {
|
||||
return zlmresTfulUtils.startSendRtpTalk(mediaServer, param, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待转推的流是否就绪
|
||||
*/
|
||||
@@ -268,4 +272,6 @@ public class ZLMServerFactory {
|
||||
param.put("ssrc", sendRtpItem.getSsrc());
|
||||
return zlmresTfulUtils.stopSendRtp(mediaServerItem, param);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user