Explorar el Código

修改语音对讲交互,删除无必要日志

kindring hace 2 años
padre
commit
a0c5bd7ca5

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/conf/security/AnonymousAuthenticationEntryPoint.java

@@ -34,7 +34,7 @@ public class    AnonymousAuthenticationEntryPoint implements AuthenticationEntry
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("code", ErrorCode.ERROR401.getCode());
         jsonObject.put("msg", ErrorCode.ERROR401.getMsg());
-        logger.info("未登陆用户");
+//        logger.info("未登陆用户");
         String logUri = "api/user/login";
         if (request.getRequestURI().contains(logUri)){
             jsonObject.put("msg", e.getMessage());

+ 1 - 0
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java

@@ -49,6 +49,7 @@ public class SIPSender {
     public void transmitRequest(String ip, Message message, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, ParseException {
         try {
             ViaHeader viaHeader = (ViaHeader)message.getHeader(ViaHeader.NAME);
+            logger.info("[server ---> {}] {}",ip,message);
             String transport = "UDP";
             if (viaHeader == null) {
                 logger.warn("[消息头缺失]: ViaHeader, 使用默认的UDP方式处理数据");

+ 5 - 4
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/SIPRequestProcessorParent.java

@@ -86,13 +86,13 @@ public abstract class SIPRequestProcessorParent {
 			sipRequest.getToHeader().setTag(SipUtils.getNewTag());
 		}
 
-		logger.info("response Ack 2");
+//		logger.info("response Ack 2");
 		SIPResponse response = (SIPResponse)getMessageFactory().createResponse(statusCode, sipRequest);
 		response.setStatusCode(statusCode);
 		if (msg != null) {
 			response.setReasonPhrase(msg);
 		}
-		logger.info("response Ack 3");
+//		logger.info("response Ack 3");
 		if (responseAckExtraParam != null) {
 			if (responseAckExtraParam.sipURI != null && sipRequest.getMethod().equals(Request.INVITE)) {
 				logger.debug("responseSdpAck SipURI: {}:{}", responseAckExtraParam.sipURI.getHost(), responseAckExtraParam.sipURI.getPort());
@@ -129,7 +129,7 @@ public abstract class SIPRequestProcessorParent {
 	 * 回复带sdp的200
 	 */
 	public SIPResponse responseSdpAck(SIPRequest request, String sdp, ParentPlatform platform) throws SipException, InvalidArgumentException, ParseException {
-		logger.info("response sdp Ack 2");
+//		logger.info("response sdp Ack 2");
 		ContentTypeHeader contentTypeHeader = SipFactory.getInstance().createHeaderFactory().createContentTypeHeader("APPLICATION", "SDP");
 
 		// 兼容国标中的使用编码@域名作为RequestURI的情况
@@ -146,7 +146,8 @@ public abstract class SIPRequestProcessorParent {
 	}
 
 	public SIPResponse responseSdpACK(SIPRequest request, String sdp,String gbId,String addr,int port) throws SipException, InvalidArgumentException, ParseException {
-		logger.info("response sdp Ack by broadcast");
+//		logger.info("response sdp Ack by broadcast");
+		logger.info("收到设备回复 语音对讲 ack");
 		ContentTypeHeader contentTypeHeader = SipFactory.getInstance().createHeaderFactory().createContentTypeHeader("APPLICATION", "SDP");
 
 		// 兼容国标中的使用编码@域名作为RequestURI的情况

+ 4 - 2
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -116,7 +116,7 @@ public class ZLMHttpHookListener {
     @PostMapping(value = "/on_server_keepalive", produces = "application/json;charset=UTF-8")
     public HookResult onServerKeepalive(@RequestBody OnServerKeepaliveHookParam param) {
 
-        logger.info("[ZLM HOOK] 收到zlm心跳:" + param.getMediaServerId());
+//        logger.info("[ZLM HOOK] 收到zlm心跳:" + param.getMediaServerId());
 
         taskExecutor.execute(() -> {
             List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_keepalive);
@@ -626,9 +626,11 @@ public class ZLMHttpHookListener {
         // 如果是音频推流则控制zlm关闭 webrtc流
 
         // 查找对应的上级推流,发送停止
-        if (!"rtp".equals(param.getApp())) {
+        if (!"rtp".equals(param.getApp()) && !"audio".equals(param.getApp())) {
+            logger.warn("[ZLM HOOK] 未知的rtpSend类型中断");
             return HookResult.SUCCESS();
         }
+        // 先停止看看
         taskExecutor.execute(() -> {
             List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
             if (sendRtpItems.size() > 0) {

+ 1 - 0
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java

@@ -74,6 +74,7 @@ public class GBRecordController {
 		if (logger.isDebugEnabled()) {
 			logger.debug(String.format("录像信息查询 API调用,deviceId:%s ,startTime:%s, endTime:%s",deviceId, startTime, endTime));
 		}
+		logger.info("[设备录像查询] {}-{}",deviceId,channelId);
 		DeferredResult<WVPResult<RecordInfo>> result = new DeferredResult<>();
 		if (!DateUtil.verification(startTime, DateUtil.formatter)){
 			throw new ControllerException(ErrorCode.ERROR100.getCode(), "startTime error, format is " + DateUtil.PATTERN);

+ 8 - 8
web_src/src/components/GBRecordDetail.vue

@@ -195,7 +195,7 @@
         this.setTime(this.chooseDate + " 00:00:00", this.chooseDate + " 23:59:59");
         this.recordsLoading = true;
         this.detailFiles = [];
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: '/api/gb_record/query/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' + this.endTime
         }).then((res)=>{
@@ -247,7 +247,7 @@
             this.playRecord();
           })
         } else {
-          this.$axios({
+          this.$axios.axios({
             method: 'get',
             url: '/api/playback/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + this.startTime + '&endTime=' +
               this.endTime
@@ -271,7 +271,7 @@
       },
       gbPlay(){
         console.log('前端控制:播放');
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: '/api/playback/resume/' + this.streamId
         }).then((res)=> {
@@ -280,14 +280,14 @@
       },
       gbPause(){
         console.log('前端控制:暂停');
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: '/api/playback/pause/' + this.streamId
         }).then(function (res) {});
       },
       gbScale(command){
         console.log('前端控制:倍速 ' + command);
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: `/api/playback/speed/${this.streamId }/${command}`
         }).then(function (res) {});
@@ -309,7 +309,7 @@
             this.downloadRecord(row);
           })
         }else {
-          this.$axios({
+          this.$axios.axios({
             method: 'get',
             url: '/api/gb_record/download/start/' + this.deviceId + '/' + this.channelId + '?startTime=' + row.startTime + '&endTime=' +
               row.endTime + '&downloadSpeed=4'
@@ -330,7 +330,7 @@
       stopDownloadRecord: function (callback) {
         this.$refs["recordVideoPlayer"].pause();
         this.videoUrl = '';
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: '/api/gb_record/download/stop/' + this.deviceId + "/" + this.channelId+ "/" + this.streamId
         }).then((res)=> {
@@ -340,7 +340,7 @@
       stopPlayRecord: function (callback) {
         this.$refs["recordVideoPlayer"].pause();
         this.videoUrl = '';
-        this.$axios({
+        this.$axios.axios({
           method: 'get',
           url: '/api/playback/stop/' + this.deviceId + "/" + this.channelId + "/" + this.streamId
         }).then(function (res) {

+ 20 - 2
web_src/src/components/common/microphone.vue

@@ -1,6 +1,6 @@
 <template>
   <div :class="sizeClass" >
-    <div class="mic" @mousedown="mouseDownHandle" @mouseup="mouseUpHandle" :title="isRecording?'录音中...':'开始录音'">
+    <div :class="`mic ${!isRecording?'mic-off':'mic-on'}`" @mousedown="mouseDownHandle" @mouseup="mouseUpHandle" :title="isRecording?'录音中...':'开始录音'">
       <i :class="`el-icon-${isRecording?'microphone':'turn-off-microphone'}`"></i>
     </div>
   </div>
@@ -49,6 +49,7 @@ export default {
       this.player.close();
       this.player = null;
       this.mediaStream = null;
+
       this.stopBroadcast();
     }
   },
@@ -60,6 +61,7 @@ export default {
       this.player = null;
       this.mediaStream = null;
       this.audioConnected = false;
+      this.isRecording = false;
       // this.getWebrtcAddress();
     },
     // 录音按钮按下
@@ -105,7 +107,13 @@ export default {
         // webrtc 拉流地址
         let playAudioStreamUrl = zlmSdpUrl.replace("push","play");
         console.log(playAudioStreamUrl);
-        let audioEncodeArr = this.pushConfig.audioEncodePt.split(",");
+        let audioEncodeArr;
+        if(this.pushConfig.audioEncodePt){
+          audioEncodeArr = this.pushConfig.audioEncodePt.split(",");
+        }else {
+          console.log("未指定编码类型");
+          audioEncodeArr = [];
+        }
         console.log("启用音频编码")
         console.log(audioEncodeArr)
         let player = new ZLMRTCClient.Endpoint(
@@ -141,6 +149,7 @@ export default {
             }
             console.log(res);
             this.audioConnected = true;
+            this.isRecording = true;
             console.log('创建音视频通道成功');
           } else if(state === 'close'){
             this.$message.warning("webrtc连接断开");
@@ -214,6 +223,7 @@ export default {
     },
     // 停止语音广播
     stopBroadcast() {
+      this.initAudioApplications();
       let url = `/api/play/stopBroadcast`
       url += `?deviceId=${this.deviceId}&channelId=${this.channelId}`;
       return this.$axios.axios({
@@ -231,6 +241,7 @@ export default {
   display: flex;
   justify-content: center;
   align-items: center;
+  cursor:pointer;
 }
 .microPhone .mic{
   width: 100%;
@@ -240,6 +251,13 @@ export default {
   align-items: center;
 }
 
+.mic-on{
+  color:red;
+}
+.mic-off{
+  color:gray;
+}
+
 .small{width: 25px;height:25px;font-size: 1.8rem;}
 .medium{width: 40px;height:40px;font-size: 2.2rem;}
 .large{width: 60px;height:60px;font-size: 2.6rem;}