Question

I'm making an application for some speech processing. For speech recording is used Android AudioRecord class. The AudioRecord instance is put in a service. A separate thread is used for calling read() method of AudioRecord class (there are enough examples on SO). The read samples are forward to my native code for further processing and they are put in some queue. In a native code one thread is doing the processing. The problem is this thread never gets a processor time. On finishing my app I call some function for cleaning my native resources. But it happens that whole process of cleaning isn't finished (I established it using calls). When I start the app again my native processing is started (reading new samples isn't started yet).

Is it possible that reading thread is using processor just for itself? Could I set a higher priority for my native (processor) thread. Or it could be some other problem.

I've even tried using AudioRecord.OnRecordPositionUpdateListener and onPeriodicNotification but with no success.

Was it helpful?

Solution

I found the solution. It was an error in my ported library. One of processing blocks calls sleep method. This library was first used under windows and sleeping time was in milliseconds. After porting this time is in seconds. So my native thread was sleeping for 50 seconds instead 50 milliseconds.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top