Ver Fonte

Limit number of features frames in the cache (#129)

Fangjun Kuang há 2 anos atrás
pai
commit
b80b74695b

+ 0 - 17
android/SherpaNcnn/.idea/deploymentTargetDropDown.xml

@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="deploymentTargetDropDown">
-    <targetSelectedWithDropDown>
-      <Target>
-        <type value="QUICK_BOOT_TARGET" />
-        <deviceKey>
-          <Key>
-            <type value="VIRTUAL_DEVICE_PATH" />
-            <value value="$USER_HOME$/.android/avd/Pixel_4_API_31.avd" />
-          </Key>
-        </deviceKey>
-      </Target>
-    </targetSelectedWithDropDown>
-    <timeTargetWasSelectedWithDropDown value="2022-12-16T07:38:50.268336Z" />
-  </component>
-</project>

+ 3 - 0
sherpa-ncnn/csrc/features.cc

@@ -27,6 +27,9 @@ namespace sherpa_ncnn {
 
 FeatureExtractor::FeatureExtractor(const knf::FbankOptions &opts)
     : opts_(opts) {
+  // cache 100 seconds of feature frames, which is more than enough
+  // for real needs
+  opts_.frame_opts.max_feature_vectors = 100 * 100;
   fbank_ = std::make_unique<knf::OnlineFbank>(opts_);
 }