Преглед изворни кода

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_);