修复大华对讲talk模式
parent
6136603b3f
commit
f625fb6aed
|
@ -175,15 +175,18 @@ public class SendRtpInfo {
|
|||
return sendRtpItem;
|
||||
}
|
||||
|
||||
public static SendRtpInfo getInstance(Integer localPort, MediaServer mediaServer, String ip, int port, String ssrc,
|
||||
String deviceId, String platformId, Integer channelId, boolean isTcp, boolean rtcp,
|
||||
public static SendRtpInfo getInstance(Integer localPort, MediaServer mediaServer, String ip, Integer port, String ssrc,
|
||||
String deviceId, String platformId, Integer channelId, Boolean isTcp, Boolean rtcp,
|
||||
String serverId) {
|
||||
if (localPort == 0) {
|
||||
return null;
|
||||
}
|
||||
SendRtpInfo sendRtpItem = new SendRtpInfo();
|
||||
sendRtpItem.setIp(ip);
|
||||
sendRtpItem.setPort(port);
|
||||
if(port != null) {
|
||||
sendRtpItem.setPort(port);
|
||||
}
|
||||
|
||||
sendRtpItem.setSsrc(ssrc);
|
||||
if (deviceId != null) {
|
||||
sendRtpItem.setTargetId(deviceId);
|
||||
|
|
|
@ -517,7 +517,14 @@ public class PlayServiceImpl implements IPlayService {
|
|||
}, userSetting.getPlayTimeout());
|
||||
|
||||
try {
|
||||
mediaServerService.startSendRtpPassive(mediaServerItem, sendRtpInfo, userSetting.getPlayTimeout() * 1000);
|
||||
Integer localPort = mediaServerService.startSendRtpPassive(mediaServerItem, sendRtpInfo, userSetting.getPlayTimeout() * 1000);
|
||||
if (localPort == null || localPort <= 0) {
|
||||
timeoutCallback.run();
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||
sessionManager.removeByStream(sendRtpInfo.getStream());
|
||||
return;
|
||||
}
|
||||
sendRtpInfo.setPort(localPort);
|
||||
}catch (ControllerException e) {
|
||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||
log.info("[语音对讲]失败 deviceId: {}, channelId: {}", device.getDeviceId(), channel.getDeviceId());
|
||||
|
|
|
@ -58,7 +58,7 @@ public interface IMediaNodeServerService {
|
|||
|
||||
Map<String, String> getFFmpegCMDs(MediaServer mediaServer);
|
||||
|
||||
void startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
Integer startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
|
||||
void startSendRtpStream(MediaServer mediaServer, SendRtpInfo sendRtpItem);
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ public interface IMediaServerService {
|
|||
|
||||
Boolean isStreamReady(MediaServer mediaServer, String rtp, String streamId);
|
||||
|
||||
void startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
Integer startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout);
|
||||
|
||||
void startSendRtp(MediaServer mediaServer, SendRtpInfo sendRtpItem);
|
||||
|
||||
|
|
|
@ -867,13 +867,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
public Integer startSendRtpPassive(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对应的实现类");
|
||||
}
|
||||
mediaNodeServerService.startSendRtpPassive(mediaServer, sendRtpItem, timeout);
|
||||
return mediaNodeServerService.startSendRtpPassive(mediaServer, sendRtpItem, timeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -329,7 +329,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
public Integer startSendRtpPassive(MediaServer mediaServer, SendRtpInfo sendRtpItem, Integer timeout) {
|
||||
Map<String, Object> param = new HashMap<>(12);
|
||||
param.put("vhost","__defaultVhost__");
|
||||
param.put("app", sendRtpItem.getApp());
|
||||
|
@ -361,6 +361,7 @@ public class ZLMMediaNodeServerService implements IMediaNodeServerService {
|
|||
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
|
||||
|
|
|
@ -1,19 +1,13 @@
|
|||
package com.genersoft.iot.vmp.media.zlm.dto.hook;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* zlm hook事件的参数
|
||||
* @author lin
|
||||
*/
|
||||
@Data
|
||||
public class HookParam {
|
||||
private String mediaServerId;
|
||||
|
||||
|
||||
|
||||
public String getMediaServerId() {
|
||||
return mediaServerId;
|
||||
}
|
||||
|
||||
public void setMediaServerId(String mediaServerId) {
|
||||
this.mediaServerId = mediaServerId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,84 +1,48 @@
|
|||
package com.genersoft.iot.vmp.media.zlm.dto.hook;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* zlm hook事件中的on_publish事件的参数
|
||||
* @author lin
|
||||
*/
|
||||
|
||||
public class OnPublishHookParam extends HookParam{
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String id;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String app;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String stream;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String ip;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String params;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private int port;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String schema;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private String vhost;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getApp() {
|
||||
return app;
|
||||
}
|
||||
|
||||
public void setApp(String app) {
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(String stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public void setParams(String params) {
|
||||
this.params = params;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
public void setSchema(String schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public String getVhost() {
|
||||
return vhost;
|
||||
}
|
||||
|
||||
public void setVhost(String vhost) {
|
||||
this.vhost = vhost;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OnPublishHookParam{" +
|
||||
|
|
|
@ -78,6 +78,12 @@ public class MediaServiceImpl implements IMediaService {
|
|||
public ResultForOnPublish authenticatePublish(MediaServer mediaServer, String app, String stream, String params) {
|
||||
// 推流鉴权的处理
|
||||
if (!"rtp".equals(app)) {
|
||||
if ("talk".equals(app) && stream.endsWith("_talk")) {
|
||||
ResultForOnPublish result = new ResultForOnPublish();
|
||||
result.setEnable_mp4(false);
|
||||
result.setEnable_audio(true);
|
||||
return result;
|
||||
}
|
||||
StreamProxy streamProxyItem = streamProxyService.getStreamProxyByAppAndStream(app, stream);
|
||||
if (streamProxyItem != null) {
|
||||
ResultForOnPublish result = new ResultForOnPublish();
|
||||
|
|
Loading…
Reference in New Issue