适配zlm的hook保活
This commit is contained in:
@@ -146,6 +146,13 @@ public interface IRedisCatchStorage {
|
||||
*/
|
||||
void removeStream(MediaServerItem mediaServerItem, String type, String app, String streamId);
|
||||
|
||||
|
||||
/**
|
||||
* 移除流信息从redis
|
||||
* @param mediaServerId
|
||||
*/
|
||||
void removeStream(String mediaServerId, String type);
|
||||
|
||||
/**
|
||||
* 开始下载录像时存入
|
||||
* @param streamInfo
|
||||
|
||||
@@ -422,4 +422,5 @@ public interface IVideoManagerStorager {
|
||||
* @return
|
||||
*/
|
||||
StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId);
|
||||
|
||||
}
|
||||
|
||||
@@ -60,4 +60,9 @@ public interface GbStreamMapper {
|
||||
|
||||
@Select("SELECT gs.*, pgs.platformId FROM gb_stream gs LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream WHERE mediaServerId=#{mediaServerId} ")
|
||||
List<GbStream> selectAllByMediaServerId(String mediaServerId);
|
||||
|
||||
@Update("UPDATE gb_stream " +
|
||||
"SET status=${status} " +
|
||||
"WHERE mediaServerId=#{mediaServerId} ")
|
||||
void updateStatusByMediaServerId(String mediaServerId, boolean status);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ public interface MediaServerMapper {
|
||||
"recordAssistPort, " +
|
||||
"defaultServer, " +
|
||||
"createTime, " +
|
||||
"updateTime" +
|
||||
"updateTime, " +
|
||||
"hookAliveInterval" +
|
||||
") VALUES " +
|
||||
"(" +
|
||||
"'${id}', " +
|
||||
@@ -60,7 +61,8 @@ public interface MediaServerMapper {
|
||||
"${recordAssistPort}, " +
|
||||
"${defaultServer}, " +
|
||||
"'${createTime}', " +
|
||||
"'${updateTime}')")
|
||||
"'${updateTime}', " +
|
||||
"${hookAliveInterval})")
|
||||
int add(MediaServerItem mediaServerItem);
|
||||
|
||||
@Update(value = {" <script>" +
|
||||
@@ -84,6 +86,7 @@ public interface MediaServerMapper {
|
||||
"<if test=\"sendRtpPortRange != null\">, sendRtpPortRange='${sendRtpPortRange}'</if>" +
|
||||
"<if test=\"secret != null\">, secret='${secret}'</if>" +
|
||||
"<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +
|
||||
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +
|
||||
"WHERE id='${id}'"+
|
||||
" </script>"})
|
||||
int update(MediaServerItem mediaServerItem);
|
||||
@@ -108,6 +111,7 @@ public interface MediaServerMapper {
|
||||
"<if test=\"sendRtpPortRange != null\">, sendRtpPortRange='${sendRtpPortRange}'</if>" +
|
||||
"<if test=\"secret != null\">, secret='${secret}'</if>" +
|
||||
"<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" +
|
||||
"<if test=\"hookAliveInterval != null\">, hookAliveInterval=${hookAliveInterval}</if>" +
|
||||
"WHERE ip='${ip}' and httpPort=${httpPort}"+
|
||||
" </script>"})
|
||||
int updateByHostAndPort(MediaServerItem mediaServerItem);
|
||||
|
||||
@@ -51,4 +51,17 @@ public interface StreamProxyMapper {
|
||||
"LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
|
||||
"WHERE st.enable=${enable} and st.mediaServerId = '${id}' order by st.createTime desc")
|
||||
List<StreamProxyItem> selectForEnableInMediaServer(String id, boolean enable);
|
||||
|
||||
@Select("SELECT st.*, pgs.gbId, pgs.name, pgs.longitude, pgs.latitude FROM stream_proxy st " +
|
||||
"LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream " +
|
||||
"WHERE st.mediaServerId = '${id}' order by st.createTime desc")
|
||||
List<StreamProxyItem> selectInMediaServer(String id);
|
||||
|
||||
@Update("UPDATE stream_proxy " +
|
||||
"SET enable=#{status} " +
|
||||
"WHERE mediaServerId=#{mediaServerId}")
|
||||
void updateStatus(boolean status, String mediaServerId);
|
||||
|
||||
@Delete("DELETE FROM stream_proxy WHERE mediaServerId=#{mediaServerId}")
|
||||
void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
|
||||
}
|
||||
|
||||
@@ -53,4 +53,7 @@ public interface StreamPushMapper {
|
||||
@Delete("DELETE FROM stream_push")
|
||||
void clear();
|
||||
|
||||
@Delete("DELETE FROM stream_push WHERE mediaServerId=#{mediaServerId}")
|
||||
void deleteWithoutGBId(String mediaServerId);
|
||||
|
||||
}
|
||||
|
||||
@@ -333,17 +333,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
|
||||
@Override
|
||||
public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, StreamInfo streamInfo) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PUSH_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId();
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId();
|
||||
redis.set(key, streamInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(MediaServerItem mediaServerItem, String type, String app, String streamId) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PUSH_PREFIX + userSetup.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerItem.getId();
|
||||
List<Object> streams = redis.scan(key);
|
||||
for (Object stream : streams) {
|
||||
redis.del((String) stream);
|
||||
}
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId();
|
||||
redis.del(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,4 +356,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
JSONObject jsonObject = (JSONObject)redis.get(key);
|
||||
return JSONObject.toJavaObject(jsonObject, ThirdPartyGB.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(String mediaServerId, String type) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId;
|
||||
List<Object> streams = redis.scan(key);
|
||||
for (Object stream : streams) {
|
||||
redis.del((String) stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -738,4 +738,5 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
public StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId) {
|
||||
return streamProxyMapper.selectOne(app, streamId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user