修复并发点播时可能出现的rtpServer开启但是还未收到流的情况,编码类型136,137,138默认开启音频通道
This commit is contained in:
@@ -83,4 +83,6 @@ public interface IMediaServerService {
|
||||
MediaServerItem getDefaultMediaServer();
|
||||
|
||||
void updateMediaServerKeepalive(String mediaServerId, JSONObject data);
|
||||
|
||||
boolean checkRtpServer(MediaServerItem mediaServerItem, String rtp, String stream);
|
||||
}
|
||||
|
||||
@@ -147,9 +147,11 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
if (streamId == null) {
|
||||
streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
|
||||
}
|
||||
int rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||
int rtpServerPort;
|
||||
if (mediaServerItem.isRtpEnable()) {
|
||||
rtpServerPort = zlmrtpServerFactory.createRTPServer(mediaServerItem, streamId, ssrcCheck?Integer.parseInt(ssrc):0, port);
|
||||
} else {
|
||||
rtpServerPort = mediaServerItem.getRtpProxyPort();
|
||||
}
|
||||
RedisUtil.set(key, mediaServerItem);
|
||||
return new SSRCInfo(rtpServerPort, ssrc, streamId);
|
||||
@@ -681,4 +683,13 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRtpServer(MediaServerItem mediaServerItem, String app, String stream) {
|
||||
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaServerItem, stream);
|
||||
if(rtpInfo.getInteger("code") == 0){
|
||||
return rtpInfo.getBoolean("exist");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,17 +164,30 @@ public class PlayServiceImpl implements IPlayService {
|
||||
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(mediaInfo, streamId);
|
||||
if(rtpInfo.getInteger("code") == 0){
|
||||
if (rtpInfo.getBoolean("exist")) {
|
||||
int localPort = rtpInfo.getInteger("local_port");
|
||||
if (localPort == 0) {
|
||||
logger.warn("[点播],点播时发现rtpServerC存在,但是尚未开始推流");
|
||||
// 此时说明rtpServer已经创建但是流还没有推上来
|
||||
WVPResult wvpResult = new WVPResult();
|
||||
wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
||||
wvpResult.setMsg("点播已经在进行中,请稍候重试");
|
||||
msg.setData(wvpResult);
|
||||
|
||||
WVPResult wvpResult = new WVPResult();
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
||||
wvpResult.setData(streamInfo);
|
||||
msg.setData(wvpResult);
|
||||
resultHolder.invokeAllResult(msg);
|
||||
return playResult;
|
||||
}else {
|
||||
WVPResult wvpResult = new WVPResult();
|
||||
wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
||||
wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
||||
wvpResult.setData(streamInfo);
|
||||
msg.setData(wvpResult);
|
||||
|
||||
resultHolder.invokeAllResult(msg);
|
||||
if (hookEvent != null) {
|
||||
hookEvent.response(mediaServerItem, JSONObject.parseObject(JSON.toJSONString(streamInfo)));
|
||||
resultHolder.invokeAllResult(msg);
|
||||
if (hookEvent != null) {
|
||||
hookEvent.response(mediaServerItem, JSONObject.parseObject(JSON.toJSONString(streamInfo)));
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
redisCatchStorage.stopPlay(streamInfo);
|
||||
storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId());
|
||||
@@ -187,7 +200,6 @@ public class PlayServiceImpl implements IPlayService {
|
||||
streamInfo = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (streamInfo == null) {
|
||||
String streamId = null;
|
||||
|
||||
Reference in New Issue
Block a user