Commit 52656bb89314142c5c96d7bbfcdf452235603a28
1 parent
241804f5
修复mediaserverId未存入导致的问题
Showing
3 changed files
with
37 additions
and
3 deletions
src/main/java/com/genersoft/iot/vmp/conf/ProxyServletConfig.java
| ... | ... | @@ -143,9 +143,13 @@ public class ProxyServletConfig { |
| 143 | 143 | MediaServerItem mediaInfo = getMediaInfoByUri(requestURI); |
| 144 | 144 | String url = super.rewriteUrlFromRequest(servletRequest); |
| 145 | 145 | if (mediaInfo == null) { |
| 146 | + logger.error("[ZLM服务访问代理],错误:处理url信息时未找到流媒体信息=>{}", requestURI); | |
| 146 | 147 | return url; |
| 147 | 148 | } |
| 148 | - return url.replace(mediaInfo.getId() + "/", "").replace("default/", ""); | |
| 149 | + if (!StringUtils.isEmpty(mediaInfo.getId())) { | |
| 150 | + url = url.replace(mediaInfo.getId() + "/", ""); | |
| 151 | + } | |
| 152 | + return url.replace("default/", ""); | |
| 149 | 153 | } |
| 150 | 154 | } |
| 151 | 155 | |
| ... | ... | @@ -258,9 +262,13 @@ public class ProxyServletConfig { |
| 258 | 262 | MediaServerItem mediaInfo = getMediaInfoByUri(requestURI); |
| 259 | 263 | String url = super.rewriteUrlFromRequest(servletRequest); |
| 260 | 264 | if (mediaInfo == null) { |
| 265 | + logger.error("[录像服务访问代理],错误:处理url信息时未找到流媒体信息=>{}", requestURI); | |
| 261 | 266 | return url; |
| 262 | 267 | } |
| 263 | - return url.replace(mediaInfo.getId() + "/", "").replace("default/", ""); | |
| 268 | + if (!StringUtils.isEmpty(mediaInfo.getId())) { | |
| 269 | + url = url.replace(mediaInfo.getId() + "/", ""); | |
| 270 | + } | |
| 271 | + return url.replace("default/", ""); | |
| 264 | 272 | } |
| 265 | 273 | } |
| 266 | 274 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -324,6 +324,9 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR |
| 324 | 324 | } |
| 325 | 325 | if (StringUtils.isEmpty(serverItem.getId())) { |
| 326 | 326 | serverItem.setId(zlmServerConfig.getGeneralMediaServerId()); |
| 327 | + mediaServerMapper.updateByHostAndPort(serverItem); | |
| 328 | + }else { | |
| 329 | + mediaServerMapper.update(serverItem); | |
| 327 | 330 | } |
| 328 | 331 | if (redisUtil.get(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + serverItem.getId()) == null) { |
| 329 | 332 | SsrcConfig ssrcConfig = new SsrcConfig(serverItem.getId(), null, sipConfig.getDomain()); |
| ... | ... | @@ -332,7 +335,6 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR |
| 332 | 335 | } |
| 333 | 336 | |
| 334 | 337 | serverItem.setStatus(true); |
| 335 | - mediaServerMapper.update(serverItem); | |
| 336 | 338 | resetOnlineServerItem(serverItem); |
| 337 | 339 | setZLMConfig(serverItem); |
| 338 | 340 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
| ... | ... | @@ -88,6 +88,30 @@ public interface MediaServerMapper { |
| 88 | 88 | " </script>"}) |
| 89 | 89 | int update(MediaServerItem mediaServerItem); |
| 90 | 90 | |
| 91 | + @Update(value = {" <script>" + | |
| 92 | + "UPDATE media_server " + | |
| 93 | + "SET updateTime='${updateTime}'" + | |
| 94 | + "<if test=\"id != null\">, id='${id}'</if>" + | |
| 95 | + "<if test=\"hookIp != null\">, hookIp='${hookIp}'</if>" + | |
| 96 | + "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" + | |
| 97 | + "<if test=\"streamIp != null\">, streamIp='${streamIp}'</if>" + | |
| 98 | + "<if test=\"httpSSlPort != null\">, httpSSlPort=${httpSSlPort}</if>" + | |
| 99 | + "<if test=\"rtmpPort != null\">, rtmpPort=${rtmpPort}</if>" + | |
| 100 | + "<if test=\"rtmpSSlPort != null\">, rtmpSSlPort=${rtmpSSlPort}</if>" + | |
| 101 | + "<if test=\"rtpProxyPort != null\">, rtpProxyPort=${rtpProxyPort}</if>" + | |
| 102 | + "<if test=\"rtspPort != null\">, rtspPort=${rtspPort}</if>" + | |
| 103 | + "<if test=\"rtspSSLPort != null\">, rtspSSLPort=${rtspSSLPort}</if>" + | |
| 104 | + "<if test=\"autoConfig != null\">, autoConfig=${autoConfig}</if>" + | |
| 105 | + "<if test=\"streamNoneReaderDelayMS != null\">, streamNoneReaderDelayMS=${streamNoneReaderDelayMS}</if>" + | |
| 106 | + "<if test=\"rtpEnable != null\">, rtpEnable=${rtpEnable}</if>" + | |
| 107 | + "<if test=\"rtpPortRange != null\">, rtpPortRange='${rtpPortRange}'</if>" + | |
| 108 | + "<if test=\"sendRtpPortRange != null\">, sendRtpPortRange='${sendRtpPortRange}'</if>" + | |
| 109 | + "<if test=\"secret != null\">, secret='${secret}'</if>" + | |
| 110 | + "<if test=\"recordAssistPort != null\">, recordAssistPort=${recordAssistPort}</if>" + | |
| 111 | + "WHERE ip='${ip}' and httpPort=${httpPort}"+ | |
| 112 | + " </script>"}) | |
| 113 | + int updateByHostAndPort(MediaServerItem mediaServerItem); | |
| 114 | + | |
| 91 | 115 | @Select("SELECT * FROM media_server WHERE id='${id}'") |
| 92 | 116 | MediaServerItem queryOne(String id); |
| 93 | 117 | ... | ... |