瀏覽代碼

Print more informative message when RTF>1 (#232)

Fangjun Kuang 2 年之前
父節點
當前提交
4a6cbf6528
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      sherpa-ncnn/csrc/alsa.cc

+ 9 - 0
sherpa-ncnn/csrc/alsa.cc

@@ -167,6 +167,15 @@ const std::vector<float> &Alsa::Read(int32_t num_samples) {
 
   // count is in frames. Each frame contains actual_channel_count_ samples
   int32_t count = snd_pcm_readi(capture_handle_, samples_.data(), num_samples);
+  if (count == -EPIPE) {
+    fprintf(
+        stderr,
+        "An overrun occurred, which means the RTF of the current "
+        "model on your board is larger than 1. You can use ./bin/sherpa-ncnn "
+        "to verify that. Please select a smaller model whose RTF is less than "
+        "1 for your board.");
+    exit(-1);
+  }
 
   samples_.resize(count * actual_channel_count_);