Merge remote-tracking branch 'upstream/wvp-28181-2.0' into wvp-28181-2.0

pull/644/head
duzeng 2022-10-17 16:40:05 +08:00
commit 9a3e93eb8c
8 changed files with 18 additions and 69 deletions

View File

@ -48,6 +48,7 @@ CREATE TABLE `device` (
`ssrcCheck` int DEFAULT '0',
`geoCoordSys` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`treeType` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`mediaServerId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'auto',
PRIMARY KEY (`id`),
UNIQUE KEY `device_deviceId_uindex` (`deviceId`)
) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

View File

@ -520,7 +520,6 @@ public class MediaServerServiceImpl implements IMediaServerService {
Map<String, Object> param = new HashMap<>();
param.put("api.secret",mediaServerItem.getSecret()); // -profile:v Baseline
param.put("ffmpeg.cmd","%s -fflags nobuffer -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s");
param.put("hook.enable","1");
param.put("hook.on_flow_report",String.format("%s/on_flow_report", hookPrex));
param.put("hook.on_play",String.format("%s/on_play", hookPrex));

View File

@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.async.DeferredResult;
import com.alibaba.fastjson.JSON;
@ -405,12 +407,11 @@ public class PlayServiceImpl implements IPlayService {
if (device == null) {
return null;
}
String mediaServerId = device.getMediaServerId();
MediaServerItem mediaServerItem;
if (mediaServerId == null) {
if (ObjectUtils.isEmpty(device.getMediaServerId()) || "auto".equals(device.getMediaServerId())) {
mediaServerItem = mediaServerService.getMediaServerForMinimumLoad();
} else {
mediaServerItem = mediaServerService.getOne(mediaServerId);
mediaServerItem = mediaServerService.getOne(device.getMediaServerId());
}
if (mediaServerItem == null) {
logger.warn("点播时未找到可使用的ZLM...");

View File

@ -98,7 +98,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
@Override
public StreamInfo save(StreamProxyItem param) {
MediaServerItem mediaInfo;
if (param.getMediaServerId() == null || "auto".equals(param.getMediaServerId())){
if (ObjectUtils.isEmpty(param.getMediaServerId()) || "auto".equals(param.getMediaServerId())){
mediaInfo = mediaServerService.getMediaServerForMinimumLoad();
}else {
mediaInfo = mediaServerService.getOne(param.getMediaServerId());

View File

@ -93,6 +93,7 @@ public interface DeviceMapper {
"<if test=\"ssrcCheck != null\">, ssrcCheck=${ssrcCheck}</if>" +
"<if test=\"geoCoordSys != null\">, geoCoordSys=#{geoCoordSys}</if>" +
"<if test=\"treeType != null\">, treeType=#{treeType}</if>" +
"<if test=\"mediaServerId != null\">, mediaServerId=#{mediaServerId}</if>" +
"WHERE deviceId='${deviceId}'"+
" </script>"})
int update(Device device);

View File

@ -1,12 +0,0 @@
package com.genersoft.iot.vmp.utils;
import java.util.Arrays;
public class CollectionUtil {
public static <T> boolean contains(T[] array, final T element) {
return array != null && Arrays.stream(array).anyMatch((x) -> {
return ObjectUtils.nullSafeEquals(x, element);
});
}
}

View File

@ -1,41 +0,0 @@
package com.genersoft.iot.vmp.utils;
import java.util.Arrays;
public class ObjectUtils {
public static boolean nullSafeEquals(Object o1, Object o2) {
if (o1 == o2) {
return true;
} else if (o1 != null && o2 != null) {
if (o1.equals(o2)) {
return true;
} else {
return o1.getClass().isArray() && o2.getClass().isArray() && arrayEquals(o1, o2);
}
} else {
return false;
}
}
private static boolean arrayEquals(Object o1, Object o2) {
if (o1 instanceof Object[] && o2 instanceof Object[]) {
return Arrays.equals((Object[])((Object[])o1), (Object[])((Object[])o2));
} else if (o1 instanceof boolean[] && o2 instanceof boolean[]) {
return Arrays.equals((boolean[])((boolean[])o1), (boolean[])((boolean[])o2));
} else if (o1 instanceof byte[] && o2 instanceof byte[]) {
return Arrays.equals((byte[])((byte[])o1), (byte[])((byte[])o2));
} else if (o1 instanceof char[] && o2 instanceof char[]) {
return Arrays.equals((char[])((char[])o1), (char[])((char[])o2));
} else if (o1 instanceof double[] && o2 instanceof double[]) {
return Arrays.equals((double[])((double[])o1), (double[])((double[])o2));
} else if (o1 instanceof float[] && o2 instanceof float[]) {
return Arrays.equals((float[])((float[])o1), (float[])((float[])o2));
} else if (o1 instanceof int[] && o2 instanceof int[]) {
return Arrays.equals((int[])((int[])o1), (int[])((int[])o2));
} else if (o1 instanceof long[] && o2 instanceof long[]) {
return Arrays.equals((long[])((long[])o1), (long[])((long[])o2));
} else {
return o1 instanceof short[] && o2 instanceof short[] && Arrays.equals((short[]) ((short[]) o1), (short[]) ((short[]) o2));
}
}
}

View File

@ -18,17 +18,17 @@
<el-form-item label="设备名称" prop="name">
<el-input v-model="form.name" clearable></el-input>
</el-form-item>
<!-- <el-form-item label="流媒体ID" prop="mediaServerId">-->
<!-- <el-select v-model="form.mediaServerId" style="float: left; width: 100%" >-->
<!-- <el-option key="auto" label="自动负载最小" value="null"></el-option>-->
<!-- <el-option-->
<!-- v-for="item in mediaServerList"-->
<!-- :key="item.id"-->
<!-- :label="item.id"-->
<!-- :value="item.id">-->
<!-- </el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<el-form-item label="流媒体ID" prop="mediaServerId">
<el-select v-model="form.mediaServerId" style="float: left; width: 100%" >
<el-option key="auto" label="自动负载最小" value="auto"></el-option>
<el-option
v-for="item in mediaServerList"
:key="item.id"
:label="item.id"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="字符集" prop="charset" >
<el-select v-model="form.charset" style="float: left; width: 100%" >