Forum

Results 1 to 2 of 2
  1. #1
    Join Date
    July 2017
    Posts
    8

    C# client hangs when acquiring data from custom device

    I'm having issues with a custom device using the C# SDK with mono 5.14 on Ubuntu 18.04 x64. I've taken the full client example code and snipped out the bits I don't need, added a custom device (virtualDevice), and added the following Task which is meant to acquire data from the custom device every 20 ms and process it. The client consistently runs fine for around 213 seconds, then hangs. After several seconds the client then displays a "Dropping client 1 because of ping timeout 19 0 0" error, however the client stays unresponsive. If I comment out the AcquireData method, the Task and counter runs indefinitely. I've compiled the app with the -debug flag, and run it with --debug but it's not showing any errors when it hangs. No idea why this task would be causing the hang. Custom device thread safety?

    Code:
    var virtualDevice = new CustomDevice(
        "VirtualDevice",
        // Playback
        SamplingRate.Hz16000,
        1,
        // Capture
        SamplingRate.Hz16000,
        1);
    
    
    Connection.OpenPlayback(virtualDevice);
    Connection.OpenCapture(virtualDevice);
    
    <snip>
    
    Task.Run(() =>
    {
    var count = 0; var samples = (int)(16000 * 0.02); var buffer = new short[samples]; while (true) { if (virtualDevice.AcquireData(buffer, samples)) { // Do something with the voice data } else { // Do something else } count++; if (count % 50 == 0) { // Display a counter every second so that I can tell exactly when it hangs Console.WriteLine(count / 50); } Thread.Sleep(20); }
    });
    Last edited by sjpritchard; September 26th, 2018 at 12:47 AM.

  2. #2
    Join Date
    July 2017
    Posts
    8
    I've tested the exact same code using Windows (ie not using mono), and it runs fine. So the issue is with Linux/mono.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. error configuring the preprocessor (custom device)
    By esquilax in forum General Questions
    Replies: 0
    Last Post: October 26th, 2016, 11:40 AM
  2. [Not possible] Client hangs
    By ferdl9999 in forum Linux
    Replies: 5
    Last Post: November 6th, 2014, 11:53 AM
  3. Using of custom capture device
    By Bambr in forum General Questions
    Replies: 0
    Last Post: September 6th, 2014, 02:46 PM
  4. TS3.0.10 ALSA Capture-Device Custom config
    By Shen Long in forum Bug Reports [EN/DE]
    Replies: 0
    Last Post: April 12th, 2013, 05:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •