Error when running deepstream-audio sample app in a thread of deepstream-app (main thread)

I run successfully deepstream-audio sample app via below command:
$/opt/nvidia/deepstream/deepstream-6.2/sources/apps/sample_apps/deepstream-audio/deepstream-audio -c configs/ds_audio_sonyc_test_config.txt

In main function of other deepstream app (written by C++), I create a thread to run deepstream-audio command above and then get output using popen() funtion, but when I run deepstream app, one thread of deepstream-audio was created but deepstream-audio not run and shown error like below logs.

Could you help me to fix it?
Thank you very much.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only) 5.1.1
• TensorRT Version 8.6
• Issue Type( questions, new requirements, bugs) questions/bugs

**logs
WARNING: [TRT]: Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
WARNING: [TRT]: The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
INFO: [Implicit Engine Info]: layers num: 2
0 INPUT kFLOAT input.1 1x635x128
1 OUTPUT kFLOAT output1 31

Runtime commands:
h: Print this help
q: Quit

    p: Pause
    r: Resume

**PERF AUDIO: FPS 0 (Avg)
**PERF AUDIO: 0.00 (0.00)
** INFO: <bus_callback:137>: Pipeline ready

** INFO: <bus_callback:123>: Pipeline running

**PERF AUDIO: FPS 0 (Avg)
**PERF AUDIO: 0.00 (0.00)
0:00:07.094467074 93942 0xaaaaab343d20 WARN audio-resampler audio-resampler.c:274:convert_taps_gint16_c: can’t find exact taps
0:00:07.095130611 93942 0xaaaaab343d20 WARN nvstreammux gstnvstreammux.cpp:1051:configure_module:<src_bin_muxer> No config-file provided; falling back to default streammux config 1

Segmentation fault (core dumped)
--------- Audio Thread End—
deepstream-audio was stoped and deepstream-app still continues to run.

Do you mean run deepstream-audio like below?

int main(int argc, char **argv) {
  FILE *fp =
      popen("../deepstream-audio -c ds_audio_sonyc_test_config.txt", "r");

  if (fp == nullptr) {
    std::cout << "popen failed: " << errno << " " << strerror(errno)
              << std::endl;
    return 1;
  }

  char buf[256];
  // check if the output stream is ended.
  while (!feof(fp)) {
    // try to read 255 bytes from the stream, this operation is BLOCKING ...
    int size = fread(buf, 1, 255, fp);

    // there are something or nothing to read because the stream is closed or
    // the program catch an error signal
    if (size > 0) {
      std::cout << buf << std::endl;
    }
  }

  int r = pclose(fp);
  std::cout << "exit status: " << WEXITSTATUS(r) << std::endl;

  return 0;
}

It’s can work normally.

1 Like

yes, that’s right.
Thank you so much.
I tried again, it works fine when I run deepstream app (including executing deepstream-audio command) via Terminal, but it shown the error above when running deepstream app in Debugging of VS Code (I created ./vscode/launch.json and ./vscode/setting.json files), I still don’t know root cause.

Sorry, It’s not deepstream issue.

If you want debug your app,you can change the relative path in the configuration file to an absolute path.

Thank you for your support.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.