Overrun occurring in RecordThread in continuous loops

158 views
Skip to first unread message

Sameer Joshi

unread,
Jun 6, 2017, 12:41:38 PM6/6/17
to android-porting
Hi All,

We are working on porting Android on a new platform.

The phone is supposed to be a VOIP phone and has to have the best audio quality. 

While working on to achieve the same, we are encountering an issue where there are overruns occurring in RecordThread (AudioIn) thread on capture side. 

There are continuous prints in logcat printing following:

Jun  6 10:15:06 localhost 148.147.202.139 ANDROID: +00:00 2017 000 0 | 06-06 10:15:05.633 E/AudioFlinger(  306): read failed: framesRead=-2147483631 


This negative number indicates an overrun condition where the RecordThread is reading slower than the FastCapture thread speed with which it is writing the data to the buffer.

My observation here is in the RecordThread , overrun condition is handled such that it puts the input stream into stand by mode. 

However, this results into pcm_close and pcm_open in loops, since FastCapture thread again gets the trigger to read from PCM. This then puts the data again into the buffer resulting into overrun in loops. 

For handling overrun in PipeReader, I see the code modifies the read buffer value but that does not seem to be sufficient if there are higher number of bytes being put by FastCapture into the pipe in every cycle. 

Question I have is how is the OVERRUN handled in capture side ? This problem actually results in no audio in our case and we are not able to find the solution to it easily. 


Regards,

Sameer Joshi 

Reply all
Reply to author
Forward
0 new messages