Lawrence
2020-10-24 e30e28712f7ec5a3c5514484b34bdde11d0954c3
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -14,6 +14,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
@@ -44,7 +45,16 @@
   @Autowired
   private IVideoManagerStorager storager;
   @Autowired
   private ZLMRESTfulUtils zlmresTfulUtils;
   @Value("${media.ip}")
   private String mediaIp;
   @Value("${media.port}")
   private int mediaPort;
   /**
    * 流量统计事件,播放器或推流器断开时并且耗用流量超过特定阈值时会触发此事件,阈值通过配置文件general.flowThreshold配置;此事件对回复不敏感。
    *  
@@ -118,6 +128,8 @@
      }
      String app = json.getString("app");
      String streamId = json.getString("id");
//      String ssrc = String.format("%10d", Integer.parseInt(streamId, 16)); // ZLM 要求大写且首位补零
      String ssrc = new DecimalFormat("0000000000").format(Integer.parseInt(streamId, 16));
      StreamInfo streamInfo = storager.queryPlayBySSRC(ssrc);
@@ -308,6 +320,7 @@
//      List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class);
//      MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0);
      MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class);
      mediaServerConfig.setLocalIP(mediaIp);
      storager.updateMediaInfo(mediaServerConfig);
      // TODO Auto-generated method stub