兼容zlm-pro转码

pull/1489/head
648540858 2024-05-17 16:32:01 +08:00
parent 5564cfb384
commit 49101a37e0
9 changed files with 39 additions and 5 deletions

View File

@ -143,8 +143,8 @@ public class NotifyRequestForMobilePositionProcessor extends SIPRequestProcessor
}
}
// logger.info("[收到移动位置订阅通知]{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(),
// mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime);
logger.debug("[收到移动位置订阅通知]{}/{}->{}.{}, 时间: {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(),
mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime);
mobilePosition.setReportSource("Mobile Position");
mobilePositionService.add(mobilePosition);

View File

@ -331,6 +331,9 @@ public class ZLMServerConfig extends HookParam {
@JSONField(name = "shell.shell")
private String shellPhell;
@JSONField(name = "transcode.suffix")
private String transcodeSuffix;
public String getHookIp() {
return hookIp;
@ -1211,4 +1214,12 @@ public class ZLMServerConfig extends HookParam {
public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) {
this.hookOnRtpServerTimeout = hookOnRtpServerTimeout;
}
public String getTranscodeSuffix() {
return transcodeSuffix;
}
public void setTranscodeSuffix(String transcodeSuffix) {
this.transcodeSuffix = transcodeSuffix;
}
}

View File

@ -86,6 +86,9 @@ public class MediaServerItem{
@Schema(description = "录像存储路径")
private String recordPath;
@Schema(description = "转码的前缀")
private String transcodeSuffix;
public MediaServerItem() {
}
@ -108,6 +111,7 @@ public class MediaServerItem{
rtpEnable = false; // 默认使用单端口;直到用户自己设置开启多端口
rtpPortRange = zlmServerConfig.getPortRange().replace("_",","); // 默认使用30000,30500作为级联时发送流的端口号
recordAssistPort = 0; // 默认关闭
transcodeSuffix = zlmServerConfig.getTranscodeSuffix();
}
@ -318,4 +322,12 @@ public class MediaServerItem{
public void setRecordPath(String recordPath) {
this.recordPath = recordPath;
}
public String getTranscodeSuffix() {
return transcodeSuffix;
}
public void setTranscodeSuffix(String transcodeSuffix) {
this.transcodeSuffix = transcodeSuffix;
}
}

View File

@ -410,6 +410,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
if (serverItem.getRtpProxyPort() == 0) {
serverItem.setRtpProxyPort(zlmServerConfig.getRtpProxyPort());
}
serverItem.setTranscodeSuffix(zlmServerConfig.getTranscodeSuffix());
serverItem.setStatus(true);
if (ObjectUtils.isEmpty(serverItem.getId())) {
@ -424,7 +425,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
redisTemplate.opsForValue().set(key, serverItem);
resetOnlineServerItem(serverItem);
if (serverItem.isAutoConfig()) {
setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable()));
}

View File

@ -1,6 +1,5 @@
package com.genersoft.iot.vmp.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
@ -91,6 +90,10 @@ public class MediaServiceImpl implements IMediaService {
if (addr == null) {
addr = mediaInfo.getStreamIp();
}
if (!"broadcast".equalsIgnoreCase(app) && !ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix()) && !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())) {
stream = stream + "_" + mediaInfo.getTranscodeSuffix();
streamInfoResult.setStream(stream);
}
streamInfoResult.setIp(addr);
streamInfoResult.setMediaServerId(mediaInfo.getId());

View File

@ -36,6 +36,7 @@ public interface MediaServerMapper {
"default_server,"+
"create_time,"+
"update_time,"+
"transcode_suffix,"+
"hook_alive_interval"+
") VALUES " +
"(" +
@ -62,6 +63,7 @@ public interface MediaServerMapper {
"#{defaultServer}, " +
"#{createTime}, " +
"#{updateTime}, " +
"#{transcodeSuffix}, " +
"#{hookAliveInterval})")
int add(MediaServerItem mediaServerItem);
@ -88,6 +90,7 @@ public interface MediaServerMapper {
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
"<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" +
"WHERE id=#{id}"+
" </script>"})
int update(MediaServerItem mediaServerItem);
@ -113,6 +116,7 @@ public interface MediaServerMapper {
"<if test=\"recordAssistPort != null\">, record_assist_port=#{recordAssistPort}</if>" +
"<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" +
"<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" +
"<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" +
"<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" +
"WHERE ip=#{ip} and http_port=#{httpPort}"+
" </script>"})

View File

@ -570,7 +570,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
@Override
public void sendMobilePositionMsg(JSONObject jsonObject) {
String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION;
logger.info("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString());
logger.debug("[redis发送通知] 发送 移动位置 {}: {}", key, jsonObject.toString());
redisTemplate.convertAndSend(key, jsonObject);
}

View File

@ -0,0 +1,2 @@
alter table wvp_media_server
add transcode_suffix character varying(255);

View File

@ -0,0 +1,2 @@
alter table wvp_media_server
add transcode_suffix character varying(255);