Merge pull request #1 from lawrencehj/master

修正部分错误,简化音频判断逻辑
pull/1/head
648540858 2020-10-20 09:35:23 +08:00 committed by GitHub
commit 9af5ab43af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 682 additions and 698 deletions

View File

@ -103,7 +103,7 @@ public class SipLayer implements SipListener {
ListeningPoint udpListeningPoint = sipStack.createListeningPoint(sipConfig.getSipIp(), sipConfig.getSipPort(), "UDP");
SipProvider udpSipProvider = sipStack.createSipProvider(udpListeningPoint);
udpSipProvider.addSipListener(this);
logger.info("Sip Server TCP 启动成功 port {" + sipConfig.getSipPort() + "}");
logger.info("Sip Server UDP 启动成功 port {" + sipConfig.getSipPort() + "}");
return udpSipProvider;
}

View File

@ -54,7 +54,5 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> {
// 处理离线监听
storager.outline(event.getDeviceId());
//
}
}

View File

@ -203,7 +203,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
deviceChannel.setLongitude(itemDevice.element("Longitude") == null? 0.00:Double.parseDouble(XmlUtil.getText(itemDevice,"Longitude")));
deviceChannel.setLatitude(itemDevice.element("Latitude") == null? 0.00:Double.parseDouble(XmlUtil.getText(itemDevice,"Latitude")));
deviceChannel.setPTZType(itemDevice.element("PTZType") == null? 0:Integer.parseInt(XmlUtil.getText(itemDevice,"PTZType")));
deviceChannel.setHasAudio(false); // 默认含有音频为false
deviceChannel.setHasAudio(true); // 默认含有音频播放时再检查是否有音频及是否AAC
storager.updateChannel(device.getDeviceId(), deviceChannel);
}

View File

@ -52,6 +52,9 @@ public class ZLMUtils {
currentPort = udpPortRangeArray[0];
return udpPortRangeArray[0];
} else {
if (currentPort % 2 == 1) {
currentPort++;
}
return currentPort++;
}
}

View File

@ -46,6 +46,6 @@ media: #zlm服务器的ip与http端口, 重点: 这是http端口
streamNoneReaderDelayMS: 1800000 # 无人观看多久自动关闭流
rtp: # 启用udp多端口模式
enable: true
udpPortRange: 30000,300500 # 端口范围
udpPortRange: 30000,30500 # 端口范围

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>gb_web</title>
<title>GB28181服务器</title>
</head>
<body>
<script type="text/javascript" src="./js/liveplayer-lib.min.js"></script>

View File

@ -11,7 +11,7 @@
</div>
<div style="background-color: #FFFFFF; margin-bottom: 1rem; position: relative; padding: 0.5rem; text-align: left;font-size: 14px;">
<el-button icon="el-icon-arrow-left" size="mini" style="margin-right: 1rem;" @click="showDevice"></el-button>
<el-button icon="el-icon-arrow-left" size="mini" style="margin-right: 1rem;" type="primary" @click="showDevice"></el-button>
搜索: <el-input @input="search" style="margin-right: 1rem; width: auto;" size="mini" placeholder="关键字" prefix-icon="el-icon-search" v-model="searchSrt" clearable> </el-input>
通道类型: <el-select size="mini" @change="search" style="margin-right: 1rem;" v-model="channelType" placeholder="请选择" default-first-option>
@ -37,10 +37,7 @@
</el-table-column>
<el-table-column label="开启音频" align="center">
<template slot-scope="scope">
<el-switch
@change="updateChannel(scope.row)"
v-model="scope.row.hasAudio"
active-color="#409EFF">
<el-switch @change="updateChannel(scope.row)" v-model="scope.row.hasAudio" active-color="#409EFF">
</el-switch>
</template>
</el-table-column>
@ -66,15 +63,7 @@
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right"
@size-change="handleSizeChange"
@current-change="currentChange"
:current-page="currentPage"
:page-size="count"
:page-sizes="[15, 20, 30, 50]"
layout="total, sizes, prev, pager, next"
:total="total">
<el-pagination style="float: right" @size-change="handleSizeChange" @current-change="currentChange" :current-page="currentPage" :page-size="count" :page-sizes="[15, 20, 30, 50]" layout="total, sizes, prev, pager, next" :total="total">
</el-pagination>
</el-main>
@ -185,7 +174,6 @@
},
//gb28181
//
refDevice: function (itemData) {
@ -218,15 +206,14 @@
}).then(function (res) {
console.log(res.data)
let ssrc = res.data.ssrc;
that.isLoging = false
that.isLoging = false;
if (!!ssrc) {
that.$refs.devicePlayer.play(res.data, deviceId, channelId, itemData.hasAudio);
that.initData();
} else {
that.$message.error(res.data);
}
}).catch(function(e) {
});
}).catch(function (e) {});
},
stopDevicePush: function (itemData) {
console.log(itemData)

View File

@ -25,10 +25,8 @@
</el-tab-pane>
<!--{"code":0,"data":{"paths":["22-29-30.mp4"],"rootPath":"/home/kkkkk/Documents/ZLMediaKit/release/linux/Debug/www/record/hls/kkkkk/2020-05-11/"}}-->
<el-tab-pane label="录像查询" name="second">
<el-date-picker v-model="videoHistory.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="开始时间"
@change="recordList()"></el-date-picker>
<el-date-picker v-model="videoHistory.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="结束时间"
@change="recordList()"></el-date-picker>
<el-date-picker v-model="videoHistory.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="开始时间" @change="recordList()"></el-date-picker>
<el-date-picker v-model="videoHistory.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="结束时间" @change="recordList()"></el-date-picker>
<el-table :data="videoHistory.searchHistoryResult" style="width: 100%">
<el-table-column label="名称" prop="name" width="150"></el-table-column>
<el-table-column label="文件" prop="filePath" width="300"></el-table-column>
@ -66,10 +64,8 @@
<div class="control-round-inner"><i class="fa fa-pause-circle"></i></div>
</div>
<div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i
class="el-icon-zoom-in" 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, 1)"
@mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out"></i></div>
<div style="position: absolute; left: 7.25rem; top: 1.25rem" @mousedown="ptzCamera(0, 0, 2)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-in" 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, 1)" @mouseup="ptzCamera(0, 0, 0)"><i class="el-icon-zoom-out"></i></div>
</div>
</div>
@ -124,14 +120,14 @@
play: function (streamInfo, deviceId, channelId, hasAudio) {
this.hasaudio = hasAudio;
//
if( this.hasaudio && !!streamInfo.tracks && streamInfo.tracks.length > 0) {
if (!!streamInfo.tracks && streamInfo.tracks.length > 0) {
var realHasAudio = false;
for (let i = 0; i < streamInfo.tracks; i++) {
if (streamInfo.tracks[i].codec_type == 1) { //
for (let i = 0; i < streamInfo.tracks.length; i++) {
if (streamInfo.tracks[i].codec_type == 1 && streamInfo.tracks[i].codec_id_name == "CodecAAC") { // AAC
realHasAudio = true;
}
}
this.hasaudio = realHasAudio && this.hasaudio;
this.hasaudio = realHasAudio; //&& this.hasaudio;
}
this.ssrc = streamInfo.ssrc;
this.deviceId = deviceId;