From 83641f8a0b502f91d7de8dbbdbf01d30267789f6 Mon Sep 17 00:00:00 2001
From: Yabin Li <wucong.lyb@alibaba-inc.com>
Date: 星期五, 05 五月 2023 19:24:05 +0800
Subject: [PATCH] Merge pull request #465 from alibaba-damo-academy/dev_audio
---
funasr/runtime/onnxruntime/src/audio.cpp | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/funasr/runtime/onnxruntime/src/audio.cpp b/funasr/runtime/onnxruntime/src/audio.cpp
index 8f46a4f..e6bfd28 100644
--- a/funasr/runtime/onnxruntime/src/audio.cpp
+++ b/funasr/runtime/onnxruntime/src/audio.cpp
@@ -238,6 +238,15 @@
return false;
}
+ if (!header.Validate()) {
+ return false;
+ }
+
+ header.SeekToDataChunk(is);
+ if (!is) {
+ return false;
+ }
+
*sampling_rate = header.sample_rate;
// header.subchunk2_size contains the number of bytes in the data.
// As we assume each sample contains two bytes, so it is divided by 2 here
@@ -519,4 +528,4 @@
frame_queue.push(frame);
frame = NULL;
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.1