去除ssrc作为流ID传递,ssrc只作为sdp消息使用。动态端口的情况下支持固定流地址,同时支持未点播时直接播放流地址,代码自动发起点播

This commit is contained in:
panlinlin
2020-12-19 21:52:20 +08:00
parent 0188ffd19f
commit b0080159d9
17 changed files with 117 additions and 127 deletions

View File

@@ -159,7 +159,7 @@ public class ApiDeviceController {
deviceJOSNChannel.put("PTZType ", deviceChannel.getPTZType()); // 云台类型, 0 - 未知, 1 - 球机, 2 - 半球,
// 3 - 固定枪机, 4 - 遥控枪机
deviceJOSNChannel.put("CustomPTZType", "");
deviceJOSNChannel.put("StreamID", deviceChannel.getSsrc()); // StreamID 直播流ID, 有值表示正在直播
deviceJOSNChannel.put("StreamID", deviceChannel.getStreamId()); // StreamID 直播流ID, 有值表示正在直播
deviceJOSNChannel.put("NumOutputs ", -1); // 直播在线人数
channleJSONList.add(deviceJOSNChannel);
}

View File

@@ -96,12 +96,12 @@ public class ApiStreamController {
// streamInfo = cmder.playStreamCmd(device, code);
}else {
logger.debug("streamInfo 不等于null, 向流媒体查询是否正在推流");
String streamId = String.format("%08x", Integer.parseInt(streamInfo.getSsrc())).toUpperCase();
String streamId = streamInfo.getStreamId();
JSONObject rtpInfo = zlmresTfulUtils.getRtpInfo(streamId);
if (rtpInfo.getBoolean("exist")) {
logger.debug("向流媒体查询正在推流, 直接返回: " + streamInfo.getRtsp());
JSONObject result = new JSONObject();
result.put("StreamID", streamInfo.getSsrc());
result.put("StreamID", streamInfo.getStreamId());
result.put("DeviceID", device.getDeviceId());
result.put("ChannelID", code);
result.put("ChannelName", deviceChannel.getName());
@@ -141,7 +141,7 @@ public class ApiStreamController {
if (logger.isDebugEnabled()) {
logger.debug(String.format("设备预览 API调用deviceId%s channelId%s",serial, code));
logger.debug("设备预览 API调用ssrc"+streamInfo.getSsrc()+",ZLMedia streamId:"+Integer.toHexString(Integer.parseInt(streamInfo.getSsrc())));
logger.debug("设备预览 API调用streamId"+streamInfo.getStreamId());
}
boolean lockFlag = true;
long startTime = System.currentTimeMillis();
@@ -173,7 +173,7 @@ public class ApiStreamController {
}
if(streamInfo!=null) {
JSONObject result = new JSONObject();
result.put("StreamID", streamInfo.getSsrc());
result.put("StreamID", streamInfo.getStreamId());
result.put("DeviceID", device.getDeviceId());
result.put("ChannelID", code);
result.put("ChannelName", deviceChannel.getName());
@@ -234,7 +234,7 @@ public class ApiStreamController {
result.put("error","未找到流信息");
return result;
}
cmder.streamByeCmd(streamInfo.getSsrc());
cmder.streamByeCmd(streamInfo.getStreamId());
storager.stopPlay(streamInfo);
return null;
}