Merge pull request #30 from lawrencehj/master

与2.0同步修正部分错误
pull/31/head
648540858 2021-01-11 11:24:34 +08:00 committed by GitHub
commit 4005962c5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 60 deletions

View File

@ -131,7 +131,7 @@
<artifactId>jain-sip-ri</artifactId>
<version>1.3.0-92</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/jain-sip-ri-1.3.0-92.jar</systemPath>
<systemPath>${pom.basedir}/libs/jain-sip-ri-1.3.0-92.jar</systemPath>
</dependency>
<dependency>
<groupId>log4j</groupId>
@ -141,7 +141,7 @@
<!-- xml解析库 -->
<dependency>
<groupId>org.dom4j</groupId>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>2.1.3</version>
</dependency>

View File

@ -77,6 +77,9 @@ public class SIPCommander implements ISIPCommander {
@Value("${media.seniorSdp}")
private boolean seniorSdp;
@Value("${media.autoApplyPlay}")
private boolean autoApplyPlay;
@Autowired
private ZLMHttpHookSubscribe subscribe;
@ -182,11 +185,11 @@ public class SIPCommander implements ISIPCommander {
/**
*
*
* @param cmdCode
* @param parameter1 1
* @param parameter2 2
* @param combineCode2 2
*/
* @param cmdCode
* @param parameter1 1
* @param parameter2 2
* @param combineCode2 2
*/
public static String frontEndCmdString(int cmdCode, int parameter1, int parameter2, int combineCode2) {
StringBuilder builder = new StringBuilder("A50F01");
String strTmp;
@ -208,13 +211,13 @@ public class SIPCommander implements ISIPCommander {
/**
*
*
* @param device
* @param channelId
* @param leftRight 0: 1: 2:
* @param upDown 0: 1: 2:
* @param inOut 0: 1: 2:
* @param moveSpeed
* @param zoomSpeed
* @param device
* @param channelId
* @param leftRight 0: 1: 2:
* @param upDown 0: 1: 2:
* @param inOut 0: 1: 2:
* @param moveSpeed
* @param zoomSpeed
*/
@Override
public boolean ptzCmd(Device device, String channelId, int leftRight, int upDown, int inOut, int moveSpeed,
@ -287,8 +290,12 @@ public class SIPCommander implements ISIPCommander {
@Override
public void playStreamCmd(Device device, String channelId, ZLMHttpHookSubscribe.Event event, SipSubscribe.Event errorEvent) {
try {
String ssrc = streamSession.createPlaySsrc();
String ssrc = "";
if (rtpEnable) {
ssrc = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
}else {
ssrc = streamSession.createPlaySsrc();
}
String streamId = null;
if (rtpEnable) {
streamId = String.format("gb_play_%s_%s", device.getDeviceId(), channelId);
@ -326,13 +333,14 @@ public class SIPCommander implements ISIPCommander {
if (seniorSdp) {
if("TCP-PASSIVE".equals(streamMode)) {
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) {
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if("UDP".equals(streamMode)) {
content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n");
}
content.append("a=recvonly\r\n");
content.append("a=rtpmap:96 PS/90000\r\n");
content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
content.append("a=rtpmap:126 H264/90000\r\n");
content.append("a=rtpmap:125 H264S/90000\r\n");
@ -341,7 +349,6 @@ public class SIPCommander implements ISIPCommander {
content.append("a=fmtp:99 profile-level-id=3\r\n");
content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:97 MPEG4/90000\r\n");
content.append("a=rtpmap:96 PS/90000\r\n");
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n");
@ -380,9 +387,6 @@ public class SIPCommander implements ISIPCommander {
content.append("y="+ssrc+"\r\n");//ssrc
// String fromTag = UUID.randomUUID().toString();
// Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, fromTag, null, ssrc);
Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "live", null, ssrc);
ClientTransaction transaction = transmitRequest(device, request, errorEvent);
@ -408,8 +412,16 @@ public class SIPCommander implements ISIPCommander {
, SipSubscribe.Event errorEvent) {
try {
MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
String ssrc = streamSession.createPlayBackSsrc();
String streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
String ssrc = null;
String streamId = null;
if (rtpEnable) {
ssrc = String.format("gb_playback_%s_%s", device.getDeviceId(), channelId);
streamId = ssrc;
}else {
ssrc = streamSession.createPlayBackSsrc();
streamId = String.format("%08x", Integer.parseInt(ssrc)).toUpperCase();
}
// 添加订阅
JSONObject subscribeKey = new JSONObject();
subscribeKey.put("app", "rtp");
@ -417,7 +429,6 @@ public class SIPCommander implements ISIPCommander {
subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, event);
//
StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n");
content.append("o="+sipConfig.getSipId()+" 0 0 IN IP4 "+sipConfig.getSipIp()+"\r\n");
@ -437,13 +448,14 @@ public class SIPCommander implements ISIPCommander {
if (seniorSdp) {
if("TCP-PASSIVE".equals(streamMode)) {
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if ("TCP-ACTIVE".equals(streamMode)) {
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
}else if("UDP".equals(streamMode)) {
content.append("m=video "+ mediaPort +" RTP/AVP 126 125 99 34 98 97 96\r\n");
content.append("m=video "+ mediaPort +" RTP/AVP 96 126 125 99 34 98 97\r\n");
}
content.append("a=recvonly\r\n");
content.append("a=rtpmap:96 PS/90000\r\n");
content.append("a=fmtp:126 profile-level-id=42e01e\r\n");
content.append("a=rtpmap:126 H264/90000\r\n");
content.append("a=rtpmap:125 H264S/90000\r\n");
@ -452,7 +464,6 @@ public class SIPCommander implements ISIPCommander {
content.append("a=fmtp:99 profile-level-id=3\r\n");
content.append("a=rtpmap:98 H264/90000\r\n");
content.append("a=rtpmap:97 MPEG4/90000\r\n");
content.append("a=rtpmap:96 PS/90000\r\n");
if("TCP-PASSIVE".equals(streamMode)){ // tcp被动模式
content.append("a=setup:passive\r\n");
content.append("a=connection:new\r\n");
@ -521,9 +532,6 @@ public class SIPCommander implements ISIPCommander {
if (dialog == null) {
return;
}
Request byeRequest = dialog.createRequest(Request.BYE);
SipURI byeURI = (SipURI) byeRequest.getRequestURI();
String vh = transaction.getRequest().getHeader(ViaHeader.NAME).toString();

View File

@ -297,7 +297,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
device.setStreamMode("UDP");
}
storager.updateDevice(device);
cmder.catalogQuery(device, null);
//cmder.catalogQuery(device, null);
// 回复200 OK
responseAck(evt);
if (offLineDetector.isOnline(deviceId)) {

View File

@ -19,15 +19,6 @@ public interface DeviceChannelMapper {
"'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status})")
int add(DeviceChannel channel);
// @Update("UPDATE device_channel " +
// "SET name=#{name}, manufacture=#{manufacture}, model=#{model}, owner=#{owner}, civilCode=#{civilCode}, " +
// "block=#{block}, address=#{address}, parental=#{parental}, parentId=#{parentId}, safetyWay=#{safetyWay}, " +
// "registerWay=#{registerWay}, certNum=#{certNum}, certifiable=#{certifiable}, errCode=#{errCode}, secrecy=#{secrecy}, " +
// "ipAddress=#{ipAddress}, port=#{port}, password=#{password}, PTZType=#{PTZType}, status=#{status}, streamId=#{streamId}, " +
// "hasAudio=#{hasAudio}" +
// "WHERE deviceId=#{deviceId} AND channelId=#{channelId}")
@Update(value = {" <script>" +
"UPDATE device_channel " +
"SET deviceId='${deviceId}'" +

View File

@ -61,13 +61,6 @@ public class DeviceController {
return storager.queryVideoDeviceList(page, count);
}
/**
*
* @param deviceId id
* @param page
* @param count
* @return
*/
/**
*
*

View File

@ -169,7 +169,6 @@ public class PlayController {
// 超时处理
result.onTimeout(()->{
logger.warn(String.format("设备预览/回放停止超时streamId%s ", streamId));
RequestMessage msg = new RequestMessage();
msg.setId(DeferredResultHolder.CALLBACK_CMD_STOP + uuid);
msg.setData("Timeout");

View File

@ -39,8 +39,6 @@ public class ApiStreamController {
@Autowired
private IRedisCatchStorage redisCatchStorage;
private boolean closeWaitRTPInfo = false;
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;

View File

@ -44,8 +44,8 @@
<el-table-column label="状态" width="180" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.status == 1">线</el-tag>
<el-tag size="medium" type="info" v-if="scope.row.status == 0">线</el-tag>
<el-tag size="medium" v-if="scope.row.status == 1"></el-tag>
<el-tag size="medium" type="info" v-if="scope.row.status == 0"></el-tag>
</div>
</template>
</el-table-column>
@ -99,14 +99,14 @@ export default {
total: 0,
beforeUrl: "/videoList",
isLoging: false,
autoList: false
autoList: true
};
},
mounted() {
this.initData();
if (this.autoList) {
this.updateLooper = setInterval(this.initData, 1500);
this.updateLooper = setInterval(this.initData, 5000);
}
},
@ -179,7 +179,7 @@ export default {
//
sendDevicePush: function (itemData) {
console.log(itemData)
console.log(itemData);
let deviceId = this.deviceId;
this.isLoging = true;
let channelId = itemData.channelId;

View File

@ -67,7 +67,7 @@
<div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 1)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-in control-zoom-btn" style="font-size: 1.875rem;"></i></div>
<div style="position: absolute; left: 7.25rem; top: 3.25rem; font-size: 1.875rem;" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out control-zoom-btn"></i></div>
<div class="contro-speed" style="position: absolute; left: 4px; top: 7rem; width: 9rem;">
<el-slider v-model="controSpeed"></el-slider>
<el-slider v-model="controSpeed" :max="255"></el-slider>
</div>
</div>

View File

@ -52,7 +52,7 @@
<el-table-column label="操作" width="240" align="center" fixed="right">
<template slot-scope="scope">
<el-button size="mini" :ref="scope.row.deviceId + 'refbtn' " icon="el-icon-refresh" @click="refDevice(scope.row)"></el-button>
<el-button size="mini" icon="el-icon-s-open" type="primary" @click="showChannelList(scope.row)"></el-button>
<el-button size="mini" icon="el-icon-s-open" v-bind:disabled="scope.row.online==0" type="primary" @click="showChannelList(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>