Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
DeepSpeech
提交
7c1b4328
D
DeepSpeech
项目概览
PaddlePaddle
/
DeepSpeech
大约 2 年 前同步成功
通知
210
Star
8425
Fork
1598
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
245
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DeepSpeech
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
245
Issue
245
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7c1b4328
编写于
3月 10, 2022
作者:
S
SmileGoat
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format
上级
c769d907
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
8 deletion
+6
-8
speechx/speechx/frontend/feature_cache.h
speechx/speechx/frontend/feature_cache.h
+3
-1
speechx/speechx/frontend/raw_audio.cc
speechx/speechx/frontend/raw_audio.cc
+2
-3
speechx/speechx/frontend/raw_audio.h
speechx/speechx/frontend/raw_audio.h
+1
-4
未找到文件。
speechx/speechx/frontend/feature_cache.h
浏览文件 @
7c1b4328
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
#pragma once
#include "base/common.h"
#include "base/common.h"
#include "frontend/feature_extractor_interface.h"
#include "frontend/feature_extractor_interface.h"
...
@@ -45,4 +47,4 @@ class FeatureCache : public FeatureExtractorInterface {
...
@@ -45,4 +47,4 @@ class FeatureCache : public FeatureExtractorInterface {
// DISALLOW_COPY_AND_ASSGIN(FeatureCache);
// DISALLOW_COPY_AND_ASSGIN(FeatureCache);
};
};
}
// namespace ppspeech
}
// namespace ppspeech
\ No newline at end of file
speechx/speechx/frontend/raw_audio.cc
浏览文件 @
7c1b4328
...
@@ -35,7 +35,6 @@ void RawAudioSource::AcceptWaveform(const VectorBase<BaseFloat>& data) {
...
@@ -35,7 +35,6 @@ void RawAudioSource::AcceptWaveform(const VectorBase<BaseFloat>& data) {
ring_buffer_
[
idx
%
ring_buffer_
.
size
()]
=
data
(
idx
);
ring_buffer_
[
idx
%
ring_buffer_
.
size
()]
=
data
(
idx
);
}
}
data_length_
+=
data
.
Dim
();
data_length_
+=
data
.
Dim
();
ready_read_condition_
.
notify_one
();
}
}
// bool RawAudioSource::AcceptWaveform(BaseFloat* data, int length) {
// bool RawAudioSource::AcceptWaveform(BaseFloat* data, int length) {
...
@@ -53,7 +52,7 @@ bool RawAudioSource::Read(Vector<BaseFloat>* feat) {
...
@@ -53,7 +52,7 @@ bool RawAudioSource::Read(Vector<BaseFloat>* feat) {
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
while
(
chunk_size
>
data_length_
)
{
while
(
chunk_size
>
data_length_
)
{
// when audio is empty and no more data feed
// when audio is empty and no more data feed
// ready_read_condition will block in dead lock.
// ready_read_condition will block in dead lock.
so replace with timeout_
// ready_read_condition_.wait(lock);
// ready_read_condition_.wait(lock);
int32
elapsed
=
static_cast
<
int32
>
(
timer
.
Elapsed
()
*
1000
);
int32
elapsed
=
static_cast
<
int32
>
(
timer
.
Elapsed
()
*
1000
);
if
(
elapsed
>
timeout_
)
{
if
(
elapsed
>
timeout_
)
{
...
@@ -82,4 +81,4 @@ bool RawAudioSource::Read(Vector<BaseFloat>* feat) {
...
@@ -82,4 +81,4 @@ bool RawAudioSource::Read(Vector<BaseFloat>* feat) {
return
true
;
return
true
;
}
}
}
// namespace ppspeech
}
// namespace ppspeech
\ No newline at end of file
speechx/speechx/frontend/raw_audio.h
浏览文件 @
7c1b4328
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
#include "base/common.h"
#include "base/common.h"
#include "frontend/feature_extractor_interface.h"
#include "frontend/feature_extractor_interface.h"
#pragma once
namespace
ppspeech
{
namespace
ppspeech
{
class
RawAudioSource
:
public
FeatureExtractorInterface
{
class
RawAudioSource
:
public
FeatureExtractorInterface
{
...
@@ -40,7 +38,6 @@ class RawAudioSource : public FeatureExtractorInterface {
...
@@ -40,7 +38,6 @@ class RawAudioSource : public FeatureExtractorInterface {
size_t
data_length_
;
size_t
data_length_
;
bool
finished_
;
bool
finished_
;
mutable
std
::
mutex
mutex_
;
mutable
std
::
mutex
mutex_
;
std
::
condition_variable
ready_read_condition_
;
std
::
condition_variable
ready_feed_condition_
;
std
::
condition_variable
ready_feed_condition_
;
kaldi
::
int32
timeout_
;
kaldi
::
int32
timeout_
;
...
@@ -74,4 +71,4 @@ class RawDataSource : public FeatureExtractorInterface {
...
@@ -74,4 +71,4 @@ class RawDataSource : public FeatureExtractorInterface {
DISALLOW_COPY_AND_ASSIGN
(
RawDataSource
);
DISALLOW_COPY_AND_ASSIGN
(
RawDataSource
);
};
};
}
// namespace ppspeech
}
// namespace ppspeech
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录