实现国标录像级联播放,优化点播流程,加快点播速度
This commit is contained in:
@@ -181,7 +181,7 @@ public class ZLMHttpHookListener {
|
||||
@PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8")
|
||||
public ResponseEntity<String> onPublish(@RequestBody JSONObject json) {
|
||||
|
||||
logger.debug("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
||||
logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString());
|
||||
JSONObject ret = new JSONObject();
|
||||
ret.put("code", 0);
|
||||
ret.put("msg", "success");
|
||||
|
||||
@@ -77,21 +77,23 @@ public class ZLMHttpHookSubscribe {
|
||||
if (eventMap == null) {
|
||||
return;
|
||||
}
|
||||
Iterator<Map.Entry<JSONObject, Event>> iterator = eventMap.entrySet().iterator();
|
||||
while (iterator.hasNext()){
|
||||
Map.Entry<JSONObject, Event> next = iterator.next();
|
||||
JSONObject key = next.getKey();
|
||||
Boolean result = null;
|
||||
for (String s : key.keySet()) {
|
||||
if (result == null) {
|
||||
result = key.getString(s).equals(hookResponse.getString(s));
|
||||
}else {
|
||||
if (key.getString(s) == null) continue;
|
||||
result = result && key.getString(s).equals(hookResponse.getString(s));
|
||||
|
||||
Set<Map.Entry<JSONObject, Event>> entries = eventMap.entrySet();
|
||||
if (entries.size() > 0) {
|
||||
for (Map.Entry<JSONObject, Event> entry : entries) {
|
||||
JSONObject key = entry.getKey();
|
||||
Boolean result = null;
|
||||
for (String s : key.keySet()) {
|
||||
if (result == null) {
|
||||
result = key.getString(s).equals(hookResponse.getString(s));
|
||||
}else {
|
||||
if (key.getString(s) == null) continue;
|
||||
result = result && key.getString(s).equals(hookResponse.getString(s));
|
||||
}
|
||||
}
|
||||
if (null != result && result){
|
||||
entries.remove(entry);
|
||||
}
|
||||
}
|
||||
if (null != result && result){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ public class ZLMRESTfulUtils {
|
||||
ResponseBody responseBody = response.body();
|
||||
if (responseBody != null) {
|
||||
String responseStr = responseBody.string();
|
||||
System.out.println(responseStr);
|
||||
responseJSON = JSON.parseObject(responseStr);
|
||||
}
|
||||
}else {
|
||||
|
||||
@@ -242,9 +242,18 @@ public class ZLMRTPServerFactory {
|
||||
*/
|
||||
public int totalReaderCount(MediaServerItem mediaServerItem, String app, String streamId) {
|
||||
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId);
|
||||
Integer code = mediaInfo.getInteger("code");
|
||||
if (mediaInfo == null) {
|
||||
return 0;
|
||||
}
|
||||
if ( code < 0) {
|
||||
logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg"));
|
||||
return -1;
|
||||
}
|
||||
if ( code == 0 && ! mediaInfo.getBoolean("online")) {
|
||||
logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg"));
|
||||
return -1;
|
||||
}
|
||||
return mediaInfo.getInteger("totalReaderCount");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user