Browse Source

Merge remote-tracking branch 'origin/master' into master

pull/1/head
648540858 4 years ago
parent
commit
2e9b4b4e5e
  1. 19
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
  2. 4
      src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
  3. 33
      web_src/src/components/control.vue
  4. 4
      web_src/src/components/gb28181/devicePlayer.vue

19
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java

@ -310,12 +310,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
recordInfo.setSumNum(Integer.parseInt(XmlUtil.getText(rootElement, "SumNum"))); recordInfo.setSumNum(Integer.parseInt(XmlUtil.getText(rootElement, "SumNum")));
String sn = XmlUtil.getText(rootElement, "SN"); String sn = XmlUtil.getText(rootElement, "SN");
Element recordListElement = rootElement.element("RecordList"); Element recordListElement = rootElement.element("RecordList");
if (recordListElement == null) { if (recordListElement == null || recordInfo.getSumNum() == 0) {
logger.info("无录像数据"); logger.info("无录像数据");
// responseAck(evt); // responseAck(evt);
return; // return;
} } else {
Iterator<Element> recordListIterator = recordListElement.elementIterator(); Iterator<Element> recordListIterator = recordListElement.elementIterator();
List<RecordItem> recordList = new ArrayList<RecordItem>(); List<RecordItem> recordList = new ArrayList<RecordItem>();
if (recordListIterator != null) { if (recordListIterator != null) {
@ -336,7 +335,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
record.setAddress(XmlUtil.getText(itemRecord, "Address")); record.setAddress(XmlUtil.getText(itemRecord, "Address"));
record.setStartTime( record.setStartTime(
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "StartTime"))); DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "StartTime")));
record.setEndTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "EndTime"))); record.setEndTime(
DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord, "EndTime")));
record.setSecrecy(itemRecord.element("Secrecy") == null ? 0 record.setSecrecy(itemRecord.element("Secrecy") == null ? 0
: Integer.parseInt(XmlUtil.getText(itemRecord, "Secrecy"))); : Integer.parseInt(XmlUtil.getText(itemRecord, "Secrecy")));
record.setType(XmlUtil.getText(itemRecord, "Type")); record.setType(XmlUtil.getText(itemRecord, "Type"));
@ -371,12 +371,15 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
} else { } else {
// 本分支有两种可能:1、录像列表被拆包,且是第一个包,直接保存缓存返回,等待下个包再处理 // 本分支有两种可能:1、录像列表被拆包,且是第一个包,直接保存缓存返回,等待下个包再处理
// 2、之前有包,但超时清空了,那么这次sn批次的响应数据已经不完整,等待过期时间后redis自动清空数据 // 2、之前有包,但超时清空了,那么这次sn批次的响应数据已经不完整,等待过期时间后redis自动清空数据
logger.info("已获取" + recordList.size() + "项录像数据,共" + recordInfo.getSumNum() + "项");
logger.info("等待后续的包..."); logger.info("等待后续的包...");
redis.set(cacheKey, recordList, 90); redis.set(cacheKey, recordList, 90);
return; return;
} }
}
// 自然顺序排序, 元素进行升序排列
recordInfo.getRecordList().sort(Comparator.naturalOrder());
} }
// 走到这里,有以下可能:1、没有录像信息,第一次收到recordinfo的消息即返回响应数据,无redis操作 // 走到这里,有以下可能:1、没有录像信息,第一次收到recordinfo的消息即返回响应数据,无redis操作
// 2、有录像数据,且第一次即收到完整数据,返回响应数据,无redis操作 // 2、有录像数据,且第一次即收到完整数据,返回响应数据,无redis操作
@ -386,8 +389,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
RequestMessage msg = new RequestMessage(); RequestMessage msg = new RequestMessage();
msg.setDeviceId(deviceId); msg.setDeviceId(deviceId);
msg.setType(DeferredResultHolder.CALLBACK_CMD_RECORDINFO); msg.setType(DeferredResultHolder.CALLBACK_CMD_RECORDINFO);
// 自然顺序排序, 元素进行升序排列 // // 自然顺序排序, 元素进行升序排列
recordInfo.getRecordList().sort(Comparator.naturalOrder()); // recordInfo.getRecordList().sort(Comparator.naturalOrder());
msg.setData(recordInfo); msg.setData(recordInfo);
deferredResultHolder.invokeResult(msg); deferredResultHolder.invokeResult(msg);
logger.info("处理完成,返回结果"); logger.info("处理完成,返回结果");

4
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java

@ -288,7 +288,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
// devices.add((Device)redis.get((String)deviceIdList.get(i))); // devices.add((Device)redis.get((String)deviceIdList.get(i)));
device =(Device)redis.get((String)deviceIdList.get(i)); device =(Device)redis.get((String)deviceIdList.get(i));
if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){ if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){
outline(device.getDeviceId()); // outline(device.getDeviceId());
} }
devices.add(device); devices.add(device);
} }
@ -297,7 +297,7 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
// devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i])); // devices.add((Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]));
device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]); device = (Device)redis.get(VideoManagerConstants.DEVICE_PREFIX+deviceIds[i]);
if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){ if (redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX+device.getDeviceId()).size() == 0){
outline(device.getDeviceId()); // outline(device.getDeviceId());
} }
devices.add(device); devices.add(device);
} }

33
web_src/src/components/control.vue

@ -23,8 +23,12 @@
</div> </div>
</div> </div>
<el-row :gutter="30"> <el-row :gutter="30">
<el-col :span="12"><div class="control-table" id="ThreadsLoad">table1</div></el-col> <el-col :span="12">
<el-col :span="12"><div class="control-table" id="WorkThreadsLoad">table2</div></el-col> <div class="control-table" id="ThreadsLoad">table1</div>
</el-col>
<el-col :span="12">
<div class="control-table" id="WorkThreadsLoad">table2</div>
</el-col>
</el-row> </el-row>
<el-table :data="allSessionData" style="margin-top: 1rem;"> <el-table :data="allSessionData" style="margin-top: 1rem;">
<el-table-column prop="peer_ip" label="远端"></el-table-column> <el-table-column prop="peer_ip" label="远端"></el-table-column>
@ -48,7 +52,6 @@
</template> </template>
<script> <script>
import uiHeader from './UiHeader.vue' import uiHeader from './UiHeader.vue'
import echarts from 'echarts'; import echarts from 'echarts';
@ -110,8 +113,12 @@ export default {
url: '/zlm/index/api/getThreadsLoad' url: '/zlm/index/api/getThreadsLoad'
}).then(function (res) { }).then(function (res) {
if (res.data.code == 0) { if (res.data.code == 0) {
that.tableOption.xAxis.data.push(new Date().toLocaleTimeString()); that.tableOption.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
that.table1Option.xAxis.data.push(new Date().toLocaleTimeString()); hour12: false
}));
that.table1Option.xAxis.data.push(new Date().toLocaleTimeString('chinese', {
hour12: false
}));
for (var i = 0; i < res.data.data.length; i++) { for (var i = 0; i < res.data.data.length; i++) {
if (that.tableOption.series[i] === undefined) { if (that.tableOption.series[i] === undefined) {
@ -171,13 +178,11 @@ export default {
fontSize: 15 fontSize: 15
} }
}; };
this.tableOption.dataZoom = [ this.tableOption.dataZoom = [{
{
show: true, show: true,
start: this.charZoomStart, start: this.charZoomStart,
end: this.charZoomEnd end: this.charZoomEnd
} }];
];
this.myChart = echarts.init(document.getElementById('ThreadsLoad')); this.myChart = echarts.init(document.getElementById('ThreadsLoad'));
this.myChart.setOption(this.tableOption); this.myChart.setOption(this.tableOption);
this.myChart.on('dataZoom', function (event) { this.myChart.on('dataZoom', function (event) {
@ -216,13 +221,11 @@ export default {
fontSize: 15 fontSize: 15
} }
}; };
this.table1Option.dataZoom = [ this.table1Option.dataZoom = [{
{
show: true, show: true,
start: this.charZoomStart, start: this.charZoomStart,
end: this.charZoomEnd end: this.charZoomEnd
} }];
];
this.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad')); this.myChart1 = echarts.init(document.getElementById('WorkThreadsLoad'));
this.myChart1.setOption(this.table1Option); this.myChart1.setOption(this.table1Option);
this.myChart1.on('dataZoom', function (event) { this.myChart1.on('dataZoom', function (event) {
@ -327,19 +330,23 @@ export default {
#app { #app {
height: 100%; height: 100%;
} }
.control-table { .control-table {
background-color: #ffffff; background-color: #ffffff;
height: 25rem; height: 25rem;
} }
.table-c { .table-c {
border-right: 1px solid #dcdcdc; border-right: 1px solid #dcdcdc;
border-bottom: 1px solid #dcdcdc; border-bottom: 1px solid #dcdcdc;
} }
.table-c td { .table-c td {
border-left: 1px solid #dcdcdc; border-left: 1px solid #dcdcdc;
border-top: 1px solid #dcdcdc; border-top: 1px solid #dcdcdc;
padding: 0.2rem; padding: 0.2rem;
} }
.el-table { .el-table {
width: 99.9% !important; width: 99.9% !important;
} }

4
web_src/src/components/gb28181/devicePlayer.vue

@ -223,15 +223,15 @@ export default {
play: function (streamInfo, hasAudio) { play: function (streamInfo, hasAudio) {
this.hasaudio = hasAudio; this.hasaudio = hasAudio;
// //
if (!!streamInfo.tracks && streamInfo.tracks.length > 0 && hasAudio) {
var realHasAudio = false; var realHasAudio = false;
if (!!streamInfo.tracks && streamInfo.tracks.length > 0 && hasAudio) {
for (let i = 0; i < streamInfo.tracks.length; i++) { for (let i = 0; i < streamInfo.tracks.length; i++) {
if (streamInfo.tracks[i].codec_type == 1 && streamInfo.tracks[i].codec_id_name == "CodecAAC") { // AAC if (streamInfo.tracks[i].codec_type == 1 && streamInfo.tracks[i].codec_id_name == "CodecAAC") { // AAC
realHasAudio = true; realHasAudio = true;
} }
} }
this.hasaudio = realHasAudio && this.hasaudio;
} }
this.hasaudio = realHasAudio && this.hasaudio;
this.ssrc = streamInfo.ssrc; this.ssrc = streamInfo.ssrc;
// this.$refs.videoPlayer.hasaudio = hasAudio; // this.$refs.videoPlayer.hasaudio = hasAudio;
// this.videoUrl = streamInfo.flv + "?" + new Date().getTime(); // this.videoUrl = streamInfo.flv + "?" + new Date().getTime();

Loading…
Cancel
Save