panlinlin
2021-01-05 381e3129a3e4efbf2423be6a63342fc9c35befbc
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -11,6 +11,7 @@
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.utils.IpUtil;
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
@@ -51,6 +52,9 @@
   @Autowired
   private IVideoManagerStorager storager;
   @Autowired
   private IRedisCatchStorage redisCatchStorage;
   @Autowired
   private ZLMRESTfulUtils zlmresTfulUtils;
@@ -249,13 +253,13 @@
      String app = json.getString("app");
      String streamId = json.getString("stream");
      boolean regist = json.getBoolean("regist");
      StreamInfo streamInfo = storager.queryPlayByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
      if ("rtp".equals(app) && !regist ) {
         if (streamInfo!=null){
            storager.stopPlay(streamInfo);
            redisCatchStorage.stopPlay(streamInfo);
         }else{
            streamInfo = storager.queryPlaybackByStreamId(streamId);
            storager.stopPlayback(streamInfo);
            streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
            redisCatchStorage.stopPlayback(streamInfo);
         }
      }
@@ -281,12 +285,12 @@
      String streamId = json.getString("stream");
      cmder.streamByeCmd(streamId);
      StreamInfo streamInfo = storager.queryPlayByStreamId(streamId);
      StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
      if (streamInfo!=null){
         storager.stopPlay(streamInfo);
         redisCatchStorage.stopPlay(streamInfo);
      }else{
         streamInfo = storager.queryPlaybackByStreamId(streamId);
         storager.stopPlayback(streamInfo);
         streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
         redisCatchStorage.stopPlayback(streamInfo);
      }
      
      JSONObject ret = new JSONObject();
@@ -311,7 +315,7 @@
      if (autoApplyPlay) {
         String app = json.getString("app");
         String streamId = json.getString("stream");
            StreamInfo streamInfo = storager.queryPlayByStreamId(streamId);
            StreamInfo streamInfo = redisCatchStorage.queryPlayByStreamId(streamId);
         if ("rtp".equals(app) && streamId.indexOf("gb_play") > -1 && streamInfo == null) {
            String[] s = streamId.split("_");
            if (s.length == 4) {
@@ -355,7 +359,7 @@
//      MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0);
      MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class);
      mediaServerConfig.setLocalIP(mediaIp);
      storager.updateMediaInfo(mediaServerConfig);
      redisCatchStorage.updateMediaInfo(mediaServerConfig);
      // TODO Auto-generated method stub
      
      JSONObject ret = new JSONObject();