Merge branch '2.6.9' into wvp-28181-2.0
| | |
| | | * æ¶æ¯çID |
| | | */ |
| | | private String serial; |
| | | private Object content; |
| | | private String content; |
| | | |
| | | private final static String requestTag = "req"; |
| | | private final static String responseTag = "res"; |
| | | |
| | | public static WvpRedisMsg getRequestInstance(String fromId, String toId, String cmd, String serial, Object content) { |
| | | public static WvpRedisMsg getRequestInstance(String fromId, String toId, String cmd, String serial, String content) { |
| | | WvpRedisMsg wvpRedisMsg = new WvpRedisMsg(); |
| | | wvpRedisMsg.setType(requestTag); |
| | | wvpRedisMsg.setFromId(fromId); |
| | |
| | | return wvpRedisMsg; |
| | | } |
| | | |
| | | public static WvpRedisMsg getResponseInstance(String fromId, String toId, String cmd, String serial, Object content) { |
| | | public static WvpRedisMsg getResponseInstance(String fromId, String toId, String cmd, String serial, String content) { |
| | | WvpRedisMsg wvpRedisMsg = new WvpRedisMsg(); |
| | | wvpRedisMsg.setType(responseTag); |
| | | wvpRedisMsg.setFromId(fromId); |
| | |
| | | this.cmd = cmd; |
| | | } |
| | | |
| | | public Object getContent() { |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(Object content) { |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | } |
| | |
| | | while (!taskQueue.isEmpty()) { |
| | | Message msg = taskQueue.poll(); |
| | | try { |
| | | JSONObject msgJSON = JSON.parseObject(msg.getBody(), JSONObject.class); |
| | | WvpRedisMsg wvpRedisMsg = JSON.to(WvpRedisMsg.class, msgJSON); |
| | | WvpRedisMsg wvpRedisMsg = JSON.parseObject(msg.getBody(), WvpRedisMsg.class); |
| | | logger.info("[æ¶å°REDISéç¥] æ¶æ¯ï¼ {}", JSON.toJSONString(wvpRedisMsg)); |
| | | if (!userSetting.getServerId().equals(wvpRedisMsg.getToId())) { |
| | | continue; |
| | | } |
| | |
| | | |
| | | switch (wvpRedisMsg.getCmd()){ |
| | | case WvpRedisMsgCmd.GET_SEND_ITEM: |
| | | RequestSendItemMsg content = JSON.to(RequestSendItemMsg.class, wvpRedisMsg.getContent()); |
| | | RequestSendItemMsg content = JSON.parseObject(wvpRedisMsg.getContent(), RequestSendItemMsg.class); |
| | | requestSendItemMsgHand(content, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); |
| | | break; |
| | | case WvpRedisMsgCmd.REQUEST_PUSH_STREAM: |
| | |
| | | result.setData(content); |
| | | |
| | | WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId, |
| | | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, result); |
| | | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, serial, JSON.toJSONString(result)); |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | | } |
| | |
| | | result.setMsg("æµåªä½ä¸åå¨"); |
| | | |
| | | WvpRedisMsg response = WvpRedisMsg.getResponseInstance(userSetting.getServerId(), toId, |
| | | WvpRedisMsgCmd.GET_SEND_ITEM, serial, result); |
| | | WvpRedisMsgCmd.GET_SEND_ITEM, serial, JSON.toJSONString(result)); |
| | | |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | |
| | | WVPResult<SendRtpItem> result = new WVPResult<>(); |
| | | result.setCode(ERROR_CODE_TIMEOUT); |
| | | WvpRedisMsg response = WvpRedisMsg.getResponseInstance( |
| | | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result |
| | | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, JSON.toJSONString(result) |
| | | ); |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | |
| | | result.setData(responseSendItemMsg); |
| | | |
| | | WvpRedisMsg response = WvpRedisMsg.getResponseInstance( |
| | | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, result |
| | | userSetting.getServerId(), toId, WvpRedisMsgCmd.GET_SEND_ITEM, serial, JSON.toJSONString(result) |
| | | ); |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(response); |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | |
| | | requestSendItemMsg.setServerId(serverId); |
| | | String key = UUID.randomUUID().toString(); |
| | | WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, WvpRedisMsgCmd.GET_SEND_ITEM, |
| | | key, requestSendItemMsg); |
| | | key, JSON.toJSONString(requestSendItemMsg)); |
| | | |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(redisMsg); |
| | | logger.info("[è¯·æ±æ¨æµSendItem] {}: {}", serverId, jsonObject); |
| | |
| | | public void sendMsgForStartSendRtpStream(String serverId, RequestPushStreamMsg param, PlayMsgCallbackForStartSendRtpStream callback) { |
| | | String key = UUID.randomUUID().toString(); |
| | | WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, |
| | | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, key, param); |
| | | WvpRedisMsgCmd.REQUEST_PUSH_STREAM, key, JSON.toJSONString(param)); |
| | | |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(redisMsg); |
| | | logger.info("[REDIS 请æ±å
¶ä»å¹³å°æ¨æµ] {}: {}", serverId, jsonObject); |
| | |
| | | public interface StreamPushMapper { |
| | | |
| | | @Insert("INSERT INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + |
| | | "push_time, alive_second, media_server_id, update_time, create_time, push_ing, self) VALUES" + |
| | | "push_time, alive_second, media_server_id, server_id, update_time, create_time, push_ing, self) VALUES" + |
| | | "(#{app}, #{stream}, #{totalReaderCount}, #{originType}, #{originTypeStr}, " + |
| | | "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{updateTime} , #{createTime}, " + |
| | | "#{pushTime}, #{aliveSecond}, #{mediaServerId} , #{serverId} , #{updateTime} , #{createTime}, " + |
| | | "#{pushIng}, #{self} )") |
| | | int add(StreamPushItem streamPushItem); |
| | | |
| | |
| | | "UPDATE wvp_stream_push " + |
| | | "SET update_time=#{updateTime}" + |
| | | "<if test=\"mediaServerId != null\">, media_server_id=#{mediaServerId}</if>" + |
| | | "<if test=\"serverId != null\">, server_id=#{serverId}</if>" + |
| | | "<if test=\"totalReaderCount != null\">, total_reader_count=#{totalReaderCount}</if>" + |
| | | "<if test=\"originType != null\">, origin_type=#{originType}</if>" + |
| | | "<if test=\"originTypeStr != null\">, origin_type_str=#{originTypeStr}</if>" + |
| | |
| | | |
| | | @Insert("<script>" + |
| | | "Insert INTO wvp_stream_push (app, stream, total_reader_count, origin_type, origin_type_str, " + |
| | | "create_time, alive_second, media_server_id, status, push_ing) " + |
| | | "create_time, alive_second, media_server_id, server_id, status, push_ing) " + |
| | | "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.serverId}, #{item.status} ," + |
| | | " #{item.pushIng} )" + |
| | | " </foreach>" + |
| | | "</script>") |
| | |
| | | alter table wvp_media_server |
| | | add record_day integer default 7; |
| | | |
| | | alter table wvp_stream_push |
| | | add server_id character varying(50); |
| | | |
| | | |
| | |
| | | alter table wvp_media_server |
| | | add record_day integer default 7; |
| | | |
| | | alter table wvp_stream_push |
| | | add server_id character varying(50); |
| | | |
| | | |
| | | |
| | |
| | | create_time character varying(50), |
| | | alive_second integer, |
| | | media_server_id character varying(50), |
| | | server_id character varying(50), |
| | | push_time character varying(50), |
| | | status bool default false, |
| | | update_time character varying(50), |
| | |
| | | create_time character varying(50), |
| | | alive_second integer, |
| | | media_server_id character varying(50), |
| | | server_id character varying(50), |
| | | push_time character varying(50), |
| | | status bool default false, |
| | | update_time character varying(50), |