修复ui开启音频无法播放的bug

修复可能导致录象查看的bug
修复开启openRTPServer时的bug
This commit is contained in:
648540858
2020-10-19 14:25:41 +08:00
parent 04af6de363
commit 36cd31d69d
9 changed files with 62 additions and 48 deletions

View File

@@ -538,7 +538,7 @@ public class SIPCommander implements ISIPCommander {
recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>\r\n");
recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>\r\n");
recordInfoXml.append("<Secrecy>0</Secrecy>\\r\n");
recordInfoXml.append("<Secrecy>0</Secrecy>\r\n");
// 大华NVR要求必须增加一个值为all的文本元素节点Type
recordInfoXml.append("<Type>all</Type>\r\n");
recordInfoXml.append("</Query>\r\n");

View File

@@ -140,8 +140,6 @@ public class ZLMHttpHookListener {
streamInfo.setRtmp(String.format("rtmp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtmpPort(), streamId));
streamInfo.setHls(String.format("http://%s:%s/rtp/%s/hls.m3u8", mediaInfo.getLocalIP(), mediaInfo.getHttpPort(), streamId));
streamInfo.setRtsp(String.format("rtsp://%s:%s/rtp/%s", mediaInfo.getLocalIP(), mediaInfo.getRtspPort(), streamId));
storager.startPlay(streamInfo);
}

View File

@@ -74,6 +74,15 @@ public class ZLMRESTfulUtils {
return sendPost("getMediaList",param);
}
public JSONObject getMediaInfo(String app, String schema, String stream){
Map<String, Object> param = new HashMap<>();
param.put("app",app);
param.put("schema",schema);
param.put("stream",stream);
param.put("vhost","__defaultVhost__");
return sendPost("getMediaInfo",param);
}
public JSONObject getRtpInfo(String stream_id){
Map<String, Object> param = new HashMap<>();
param.put("stream_id",stream_id);

View File

@@ -37,7 +37,7 @@ public class ZLMUtils {
System.out.println(jsonObject.toJSONString());
return newPort;
}else {
return getNewRTPPort(streamId);
return getNewRTPPort(ssrc);
}
}

View File

@@ -165,7 +165,7 @@ public class VideoManagerJdbcStoragerImpl implements IVideoManagerStorager {
@Override
public void updateCatch() {
System.out.println("##################");
}
@Override

View File

@@ -64,18 +64,25 @@ public class PlayController {
while (lockFlag) {
try {
if (System.currentTimeMillis() - startTime > 15 * 1000) {
storager.stopPlay(streamInfo);
return new ResponseEntity<String>("timeout",HttpStatus.OK);
}else {
streamInfo = storager.queryPlayByDevice(deviceId, channelId);
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
if (rtpInfo == null || !rtpInfo.getBoolean("exist") || storager.queryPlayByDevice(deviceId, channelId).getFlv() == null){
if (rtpInfo != null && rtpInfo.getBoolean("exist") && streamInfo.getFlv() != null){
JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo("rtp", "rtmp", streamId);
if (mediaInfo.getInteger("code") == 0 && mediaInfo.getBoolean("online")) {
lockFlag = false;
JSONArray tracks = mediaInfo.getJSONArray("tracks");
streamInfo.setTracks(tracks);
storager.startPlay(streamInfo);
}else {
}
}else {
Thread.sleep(2000);
continue;
}else {
lockFlag = false;
streamInfo = storager.queryPlay(streamInfo);
};
}
} catch (InterruptedException e) {