From 4137f5cf26e7c4b40853959cd2574edfde03aa60 Mon Sep 17 00:00:00 2001
From: 志浩 <neo.dzh@alibaba-inc.com>
Date: 星期五, 07 四月 2023 21:03:34 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR into dev_dzh

---
 funasr/runtime/onnxruntime/src/Audio.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/funasr/runtime/onnxruntime/src/Audio.cpp b/funasr/runtime/onnxruntime/src/Audio.cpp
index 43dfb6b..bce3a90 100644
--- a/funasr/runtime/onnxruntime/src/Audio.cpp
+++ b/funasr/runtime/onnxruntime/src/Audio.cpp
@@ -3,7 +3,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <webrtc_vad.h>
 
 #include "Audio.h"
 
@@ -138,9 +137,9 @@
     fp = fopen(filename, "rb");
     if (fp == nullptr)
         return false;
-    fseek(fp, 0, SEEK_END);
-    uint32_t nFileLen = ftell(fp);
-    fseek(fp, 44, SEEK_SET);
+    fseek(fp, 0, SEEK_END);  /*瀹氫綅鍒版枃浠舵湯灏�*/
+    uint32_t nFileLen = ftell(fp);  /*寰楀埌鏂囦欢澶у皬*/
+    fseek(fp, 44, SEEK_SET);  /*璺宠繃wav鏂囦欢澶�*/
 
     speech_len = (nFileLen - 44) / 2;
     speech_align_len = (int)(ceil((float)speech_len / align_size) * align_size);
@@ -237,7 +236,7 @@
 
     size_t nOffset = 0;
 
-#define WAV_HEADER_SIZE 44
+
 
     speech_len = nBufLen / 2;
     speech_align_len = (int)(ceil((float)speech_len / align_size) * align_size);
@@ -263,7 +262,8 @@
             speech_data[i] = (float)speech_buff[i] / scale;
         }
 
-
+        AudioFrame* frame = new AudioFrame(speech_len);
+        frame_queue.push(frame);
         return true;
 
     }
@@ -413,6 +413,7 @@
 #define SPEECH_LEN_20S (16000 * 20)
 #define SPEECH_LEN_30S (16000 * 30)
 
+/*
 void Audio::split()
 {
     VadInst *handle = WebRtcVad_Create();
@@ -471,3 +472,4 @@
     }
     WebRtcVad_Free(handle);
 }
+*/
\ No newline at end of file

--
Gitblit v1.9.1