优化适配zlm的hook保活
This commit is contained in:
@@ -140,11 +140,11 @@ public interface IRedisCatchStorage {
|
||||
|
||||
/**
|
||||
* 移除流信息从redis
|
||||
* @param mediaServerItem
|
||||
* @param mediaServerId
|
||||
* @param app
|
||||
* @param streamId
|
||||
*/
|
||||
void removeStream(MediaServerItem mediaServerItem, String type, String app, String streamId);
|
||||
void removeStream(String mediaServerId, String type, String app, String streamId);
|
||||
|
||||
|
||||
/**
|
||||
@@ -167,4 +167,6 @@ public interface IRedisCatchStorage {
|
||||
* @return
|
||||
*/
|
||||
ThirdPartyGB queryMemberNoGBId(String queryKey);
|
||||
|
||||
List<StreamInfo> getStreams(String mediaServerId, String pull);
|
||||
}
|
||||
|
||||
@@ -65,4 +65,18 @@ public interface GbStreamMapper {
|
||||
"SET status=${status} " +
|
||||
"WHERE mediaServerId=#{mediaServerId} ")
|
||||
void updateStatusByMediaServerId(String mediaServerId, boolean status);
|
||||
|
||||
@Select("SELECT * FROM gb_stream WHERE mediaServerId=#{mediaServerId}")
|
||||
void delByMediaServerId(String mediaServerId);
|
||||
|
||||
@Delete("DELETE FROM gb_stream WHERE streamType=#{type} AND gbId=NULL AND mediaServerId=#{mediaServerId}")
|
||||
void deleteWithoutGBId(String type, String mediaServerId);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE FROM gb_stream where " +
|
||||
"<foreach collection='streamProxyItemList' item='item' separator='or'>" +
|
||||
"(app=#{item.app} and stream=#{item.stream}) " +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
void batchDel(List<StreamProxyItem> streamProxyItemList);
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public interface StreamProxyMapper {
|
||||
"WHERE mediaServerId=#{mediaServerId}")
|
||||
void updateStatus(boolean status, String mediaServerId);
|
||||
|
||||
@Delete("DELETE FROM stream_proxy WHERE mediaServerId=#{mediaServerId}")
|
||||
@Delete("DELETE FROM stream_proxy WHERE enable_remove_none_reader=true AND mediaServerId=#{mediaServerId}")
|
||||
void deleteAutoRemoveItemByMediaServerId(String mediaServerId);
|
||||
|
||||
@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.enable_remove_none_reader=true AND st.mediaServerId=#{mediaServerId} order by st.createTime desc")
|
||||
List<StreamProxyItem> selecAutoRemoveItemByMediaServerId(String mediaServerId);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -31,6 +32,14 @@ public interface StreamPushMapper {
|
||||
@Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
||||
int del(String app, String stream);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE FROM stream_push where " +
|
||||
"<foreach collection='streamPushItems' item='item' separator='or'>" +
|
||||
"(app=#{item.app} and stream=#{item.stream}) " +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
int delAll(List<StreamPushItem> streamPushItems);
|
||||
|
||||
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream")
|
||||
List<StreamPushItem> selectAll();
|
||||
|
||||
@@ -56,4 +65,7 @@ public interface StreamPushMapper {
|
||||
@Delete("DELETE FROM stream_push WHERE mediaServerId=#{mediaServerId}")
|
||||
void deleteWithoutGBId(String mediaServerId);
|
||||
|
||||
@Select("SELECT * FROM stream_push WHERE mediaServerId=#{mediaServerId}")
|
||||
List<StreamPushItem> selectAllByMediaServerId(String mediaServerId);
|
||||
|
||||
}
|
||||
|
||||
@@ -338,8 +338,8 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeStream(MediaServerItem mediaServerItem, String type, String app, String streamId) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId();
|
||||
public void removeStream(String mediaServerId, String type, String app, String streamId) {
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId;
|
||||
redis.del(key);
|
||||
}
|
||||
|
||||
@@ -365,4 +365,16 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
redis.del((String) stream);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StreamInfo> getStreams(String mediaServerId, String type) {
|
||||
List<StreamInfo> result = new ArrayList<>();
|
||||
String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId;
|
||||
List<Object> streams = redis.scan(key);
|
||||
for (Object stream : streams) {
|
||||
StreamInfo streamInfo = (StreamInfo)redis.get((String) stream);
|
||||
result.add(streamInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user