移除共享所有直播流功能
This commit is contained in:
parent
7f5a18d6b5
commit
9e397ba9f6
@ -328,7 +328,6 @@ CREATE TABLE `parent_platform` (
|
||||
`ptz` int DEFAULT NULL,
|
||||
`rtcp` int DEFAULT NULL,
|
||||
`status` bit(1) DEFAULT NULL,
|
||||
`shareAllLiveStream` int DEFAULT NULL,
|
||||
`startOfflinePush` int DEFAULT '0',
|
||||
`administrativeDivision` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`catalogGroup` int DEFAULT '1',
|
||||
|
@ -55,6 +55,8 @@ alter table stream_push
|
||||
add status int DEFAULT NULL;
|
||||
alter table stream_push
|
||||
add updateTime varchar(50) default null;
|
||||
alter table stream_push
|
||||
add pushIng int DEFAULT NULL;
|
||||
alter table stream_push
|
||||
change createStamp createTime varchar(50) default null;
|
||||
|
||||
@ -68,6 +70,7 @@ update user set pushKey='453df297a57a5a7438934sda801fc3' where id=1;
|
||||
alter table parent_platform
|
||||
add treeType varchar(50) not null;
|
||||
update parent_platform set parent_platform.treeType='BusinessGroup';
|
||||
alter table parent_platform drop shareAllLiveStream;
|
||||
|
||||
alter table platform_catalog
|
||||
add civilCode varchar(50) default null;
|
||||
|
@ -104,11 +104,6 @@ public class ParentPlatform {
|
||||
*/
|
||||
private int channelCount;
|
||||
|
||||
/**
|
||||
* 共享所有的直播流
|
||||
*/
|
||||
private boolean shareAllLiveStream;
|
||||
|
||||
/**
|
||||
* 默认目录Id,自动添加的通道多放在这个目录下
|
||||
*/
|
||||
@ -319,15 +314,6 @@ public class ParentPlatform {
|
||||
this.channelCount = channelCount;
|
||||
}
|
||||
|
||||
|
||||
public boolean isShareAllLiveStream() {
|
||||
return shareAllLiveStream;
|
||||
}
|
||||
|
||||
public void setShareAllLiveStream(boolean shareAllLiveStream) {
|
||||
this.shareAllLiveStream = shareAllLiveStream;
|
||||
}
|
||||
|
||||
public String getCatalogId() {
|
||||
return catalogId;
|
||||
}
|
||||
|
@ -116,6 +116,7 @@ public class ZLMMediaListManager {
|
||||
// 查找此直播流是否存在redis预设gbId
|
||||
StreamPushItem transform = streamPushService.transform(mediaItem);
|
||||
StreamPushItem pushInDb = streamPushService.getPush(mediaItem.getApp(), mediaItem.getStream());
|
||||
transform.setPushIng(true);
|
||||
transform.setUpdateTime(DateUtil.getNow());
|
||||
transform.setPushTime(DateUtil.getNow());
|
||||
if (pushInDb == null) {
|
||||
@ -123,34 +124,7 @@ public class ZLMMediaListManager {
|
||||
streamPushMapper.add(transform);
|
||||
}else {
|
||||
streamPushMapper.update(transform);
|
||||
|
||||
|
||||
// if (!StringUtils.isEmpty(pushInDb.getGbId())) {
|
||||
// List<GbStream> gbStreamList = gbStreamMapper.selectByGBId(transform.getGbId());
|
||||
// if (gbStreamList != null && gbStreamList.size() == 1) {
|
||||
// transform.setGbStreamId(gbStreamList.get(0).getGbStreamId());
|
||||
// transform.setPlatformId(gbStreamList.get(0).getPlatformId());
|
||||
// transform.setCatalogId(gbStreamList.get(0).getCatalogId());
|
||||
// transform.setGbId(gbStreamList.get(0).getGbId());
|
||||
// gbStreamMapper.update(transform);
|
||||
// streamPushMapper.del(gbStreamList.get(0).getApp(), gbStreamList.get(0).getStream());
|
||||
// }else {
|
||||
// transform.setCreateTime(DateUtil.getNow());
|
||||
// transform.setUpdateTime(DateUtil.getNow());
|
||||
// gbStreamMapper.add(transform);
|
||||
// }
|
||||
// 通知通道上线
|
||||
// if (transform != null) {
|
||||
// if (channelOnlineEvents.get(transform.getGbId()) != null) {
|
||||
// channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream(), transform.getServerId());
|
||||
// channelOnlineEvents.remove(transform.getGbId());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
return transform;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,11 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 是否正在推流
|
||||
*/
|
||||
private boolean pushIng;
|
||||
|
||||
public String getVhost() {
|
||||
return vhost;
|
||||
}
|
||||
@ -277,5 +282,13 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public boolean isPushIng() {
|
||||
return pushIng;
|
||||
}
|
||||
|
||||
public void setPushIng(boolean pushIng) {
|
||||
this.pushIng = pushIng;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,24 +156,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
||||
result.append(", 关联国标平台[ " + param.getPlatformGbId() + " ]失败");
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(param.getGbId())) {
|
||||
// 查找开启了全部直播流共享的上级平台
|
||||
List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
|
||||
if (parentPlatforms.size() > 0) {
|
||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
||||
param.setPlatformId(parentPlatform.getServerGBId());
|
||||
param.setCatalogId(parentPlatform.getCatalogId());
|
||||
|
||||
String stream = param.getStream();
|
||||
StreamProxyItem streamProxyItems = platformGbStreamMapper.selectOne(param.getApp(), stream, parentPlatform.getServerGBId());
|
||||
if (streamProxyItems == null) {
|
||||
platformGbStreamMapper.add(param);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), param, CatalogEvent.ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wvpResult.setMsg(result.toString());
|
||||
return wvpResult;
|
||||
}
|
||||
|
@ -134,29 +134,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
stream.setStatus(true);
|
||||
stream.setCreateTime(DateUtil.getNow());
|
||||
int add = gbStreamMapper.add(stream);
|
||||
|
||||
// 查找开启了全部直播流共享的上级平台
|
||||
List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
|
||||
if (parentPlatforms.size() > 0) {
|
||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
||||
stream.setCatalogId(parentPlatform.getCatalogId());
|
||||
stream.setPlatformId(parentPlatform.getServerGBId());
|
||||
String streamId = stream.getStream();
|
||||
StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId());
|
||||
if (streamProxyItem == null) {
|
||||
platformGbStreamMapper.add(stream);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD);
|
||||
}else {
|
||||
if (!streamProxyItem.getGbId().equals(stream.getGbId())) {
|
||||
// 此流使用另一个国标Id已经与该平台关联,移除此记录
|
||||
platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId());
|
||||
platformGbStreamMapper.add(stream);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return add > 0;
|
||||
}
|
||||
|
||||
@ -345,31 +322,6 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
public void batchAdd(List<StreamPushItem> streamPushItems) {
|
||||
streamPushMapper.addAll(streamPushItems);
|
||||
gbStreamMapper.batchAdd(streamPushItems);
|
||||
// 查找开启了全部直播流共享的上级平台
|
||||
List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
|
||||
if (parentPlatforms.size() > 0) {
|
||||
for (StreamPushItem stream : streamPushItems) {
|
||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
||||
stream.setCatalogId(parentPlatform.getCatalogId());
|
||||
stream.setPlatformId(parentPlatform.getServerGBId());
|
||||
String streamId = stream.getStream();
|
||||
StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(stream.getApp(), streamId, parentPlatform.getServerGBId());
|
||||
if (streamProxyItem == null) {
|
||||
platformGbStreamMapper.add(stream);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD);
|
||||
}else {
|
||||
if (!streamProxyItem.getGbId().equals(stream.getGbId())) {
|
||||
// 此流使用另一个国标Id已经与该平台关联,移除此记录
|
||||
platformGbStreamMapper.delByAppAndStreamAndPlatform(stream.getApp(), streamId, parentPlatform.getServerGBId());
|
||||
platformGbStreamMapper.add(stream);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.ADD);
|
||||
stream.setGbId(streamProxyItem.getGbId());
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), stream, CatalogEvent.DEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,10 +16,10 @@ public interface ParentPlatformMapper {
|
||||
|
||||
@Insert("INSERT INTO parent_platform (enable, name, serverGBId, serverGBDomain, serverIP, serverPort, deviceGBId, deviceIp, " +
|
||||
" devicePort, username, password, expires, keepTimeout, transport, characterSet, ptz, rtcp, " +
|
||||
" status, shareAllLiveStream, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " +
|
||||
" status, startOfflinePush, catalogId, administrativeDivision, catalogGroup, createTime, updateTime, treeType) " +
|
||||
" VALUES (${enable}, '${name}', '${serverGBId}', '${serverGBDomain}', '${serverIP}', ${serverPort}, '${deviceGBId}', '${deviceIp}', " +
|
||||
" '${devicePort}', '${username}', '${password}', '${expires}', '${keepTimeout}', '${transport}', '${characterSet}', ${ptz}, ${rtcp}, " +
|
||||
" ${status}, ${shareAllLiveStream}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
|
||||
" ${status}, ${startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{treeType})")
|
||||
int addParentPlatform(ParentPlatform parentPlatform);
|
||||
|
||||
@Update("UPDATE parent_platform " +
|
||||
@ -41,7 +41,6 @@ public interface ParentPlatformMapper {
|
||||
"ptz=#{ptz}, " +
|
||||
"rtcp=#{rtcp}, " +
|
||||
"status=#{status}, " +
|
||||
"shareAllLiveStream=#{shareAllLiveStream}, " +
|
||||
"startOfflinePush=${startOfflinePush}, " +
|
||||
"catalogGroup=#{catalogGroup}, " +
|
||||
"administrativeDivision=#{administrativeDivision}, " +
|
||||
@ -84,9 +83,6 @@ public interface ParentPlatformMapper {
|
||||
@Update("UPDATE parent_platform SET status=#{online} WHERE serverGBId=#{platformGbID}" )
|
||||
int updateParentPlatformStatus(String platformGbID, boolean online);
|
||||
|
||||
@Select("SELECT * FROM parent_platform WHERE shareAllLiveStream=true")
|
||||
List<ParentPlatform> selectAllAhareAllLiveStream();
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
"UPDATE parent_platform " +
|
||||
"SET catalogId=#{catalogId}, updateTime=#{updateTime}" +
|
||||
|
@ -15,9 +15,9 @@ import java.util.List;
|
||||
public interface StreamPushMapper {
|
||||
|
||||
@Insert("INSERT INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
|
||||
"pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime) VALUES" +
|
||||
"pushTime, aliveSecond, mediaServerId, serverId, updateTime, createTime, pushIng) VALUES" +
|
||||
"('${app}', '${stream}', '${totalReaderCount}', '${originType}', '${originTypeStr}', " +
|
||||
"'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}' )")
|
||||
"'${pushTime}', '${aliveSecond}', '${mediaServerId}' , '${serverId}' , '${updateTime}' , '${createTime}', ${pushIng} )")
|
||||
int add(StreamPushItem streamPushItem);
|
||||
|
||||
|
||||
@ -30,6 +30,7 @@ public interface StreamPushMapper {
|
||||
"<if test=\"originTypeStr != null\">, originTypeStr='${originTypeStr}'</if>" +
|
||||
"<if test=\"pushTime != null\">, pushTime='${pushTime}'</if>" +
|
||||
"<if test=\"aliveSecond != null\">, aliveSecond='${aliveSecond}'</if>" +
|
||||
"<if test=\"pushIng != null\">, pushIng=${pushIng}</if>" +
|
||||
"WHERE app=#{app} AND stream=#{stream}"+
|
||||
" </script>"})
|
||||
int update(StreamPushItem streamPushItem);
|
||||
@ -88,10 +89,11 @@ public interface StreamPushMapper {
|
||||
|
||||
@Insert("<script>" +
|
||||
"Insert IGNORE INTO stream_push (app, stream, totalReaderCount, originType, originTypeStr, " +
|
||||
"createTime, aliveSecond, mediaServerId, status) " +
|
||||
"createTime, aliveSecond, mediaServerId, status, pushIng) " +
|
||||
"VALUES <foreach collection='streamPushItems' item='item' index='index' separator=','>" +
|
||||
"( '${item.app}', '${item.stream}', '${item.totalReaderCount}', #{item.originType}, " +
|
||||
"'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}', ${item.status} )" +
|
||||
"'${item.originTypeStr}',#{item.createTime}, #{item.aliveSecond}, '${item.mediaServerId}', ${item.status} ," +
|
||||
" ${item.pushIng} )" +
|
||||
" </foreach>" +
|
||||
"</script>")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
|
||||
@ -114,6 +116,11 @@ public interface StreamPushMapper {
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
int updateStatus(String app, String stream, boolean status);
|
||||
|
||||
@Update("UPDATE stream_push " +
|
||||
"SET pushIng=${pushIng} " +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
int updatePushStatus(String app, String stream, boolean status);
|
||||
|
||||
@Update("UPDATE stream_push " +
|
||||
"SET status=#{status} " +
|
||||
"WHERE mediaServerId=#{mediaServerId}")
|
||||
|
@ -443,20 +443,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
// 更新缓存
|
||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
||||
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
|
||||
if (parentPlatform.isEnable()) {
|
||||
// 共享所有视频流,需要将现有视频流添加到此平台
|
||||
List<GbStream> gbStreams = gbStreamMapper.queryStreamNotInPlatform();
|
||||
if (gbStreams.size() > 0) {
|
||||
for (GbStream gbStream : gbStreams) {
|
||||
gbStream.setCatalogId(parentPlatform.getCatalogId());
|
||||
}
|
||||
if (parentPlatform.isShareAllLiveStream()) {
|
||||
gbStreamService.addPlatformInfo(gbStreams, parentPlatform.getServerGBId(), parentPlatform.getCatalogId());
|
||||
}else {
|
||||
gbStreamService.delPlatformInfo(parentPlatform.getServerGBId(), gbStreams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
@ -673,24 +659,6 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
|
||||
streamPushMapper.del(streamPushItem.getApp(), streamPushItem.getStream());
|
||||
streamPushMapper.add(streamPushItem);
|
||||
mediaOffline(streamPushItem.getApp(), streamPushItem.getStream());
|
||||
|
||||
if(!StringUtils.isEmpty(streamPushItem.getGbId() )){
|
||||
// 查找开启了全部直播流共享的上级平台
|
||||
List<ParentPlatform> parentPlatforms = parentPlatformMapper.selectAllAhareAllLiveStream();
|
||||
if (parentPlatforms.size() > 0) {
|
||||
for (ParentPlatform parentPlatform : parentPlatforms) {
|
||||
StreamProxyItem streamProxyItem = platformGbStreamMapper.selectOne(streamPushItem.getApp(), streamPushItem.getStream(),
|
||||
parentPlatform.getServerGBId());
|
||||
if (streamProxyItem == null) {
|
||||
streamPushItem.setCatalogId(parentPlatform.getCatalogId());
|
||||
streamPushItem.setPlatformId(parentPlatform.getServerGBId());
|
||||
platformGbStreamMapper.add(streamPushItem);
|
||||
eventPublisher.catalogEventPublishForStream(parentPlatform.getServerGBId(), streamPushItem, CatalogEvent.ADD);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,12 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="正在推流" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.status ? '是' : '否' }}
|
||||
{{scope.row.pushIng ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="本平台推流" min-width="100">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.pushIng && !!!scope.row.serverId ? '是' : '否' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
@ -97,7 +97,6 @@
|
||||
<el-form-item label="其他选项">
|
||||
<el-checkbox label="启用" v-model="platform.enable" @change="checkExpires"></el-checkbox>
|
||||
<el-checkbox label="云台控制" v-model="platform.ptz"></el-checkbox>
|
||||
<el-checkbox label="共享所有直播流" v-model="platform.shareAllLiveStream"></el-checkbox>
|
||||
<el-checkbox label="拉起离线推流" v-model="platform.startOfflinePush"></el-checkbox>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
@ -159,7 +158,6 @@ export default {
|
||||
keepTimeout: 60,
|
||||
transport: "UDP",
|
||||
characterSet: "GB2312",
|
||||
shareAllLiveStream: false,
|
||||
startOfflinePush: false,
|
||||
catalogGroup: 1,
|
||||
administrativeDivision: null,
|
||||
@ -225,7 +223,6 @@ export default {
|
||||
this.platform.keepTimeout = platform.keepTimeout;
|
||||
this.platform.transport = platform.transport;
|
||||
this.platform.characterSet = platform.characterSet;
|
||||
this.platform.shareAllLiveStream = platform.shareAllLiveStream;
|
||||
this.platform.catalogId = platform.catalogId;
|
||||
this.platform.startOfflinePush = platform.startOfflinePush;
|
||||
this.platform.catalogGroup = platform.catalogGroup;
|
||||
@ -320,7 +317,6 @@ export default {
|
||||
transport: "UDP",
|
||||
characterSet: "GB2312",
|
||||
treeType: "BusinessGroup",
|
||||
shareAllLiveStream: false,
|
||||
startOfflinePush: false,
|
||||
catalogGroup: 1,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user