Merge branch 'speechx' into thread_inter_dev

pull/2839/head
YangZhou 3 years ago committed by GitHub
commit e7ab421e9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -45,21 +45,11 @@ bool FeatureCache::Read(std::vector<kaldi::BaseFloat>* feats) {
} while (result);
}
//while (cache_.empty() && base_extractor_->IsFinished() == false) {
//// todo refactor: wait
//// ready_read_condition_.wait(lock);
//int32 elapsed = static_cast<int32>(timer.Elapsed() * 1000); // ms
//if (elapsed > timeout_) {
//return false;
//}
//usleep(100); // sleep 0.1 ms
//}
if (cache_.empty()) return false;
// read from cache
*feats = cache_.front();
cache_.pop();
//ready_feed_condition_.notify_one();
VLOG(1) << "FeatureCache::Read cost: " << timer.Elapsed() << " sec.";
return true;
}
@ -81,16 +71,9 @@ bool FeatureCache::Compute() {
vector<BaseFloat> feature_chunk(feature.data() + start,
feature.data() + start + dim_);
// std::unique_lock<std::mutex> lock(mutex_);
//while (cache_.size() >= max_size_) {
// cache full, wait
// ready_feed_condition_.wait(lock);
//}
// feed cache
cache_.push(feature_chunk);
++nframe_;
//ready_read_condition_.notify_one();
}
VLOG(1) << "FeatureCache::Compute cost: " << timer.Elapsed() << " sec. "

Loading…
Cancel
Save