> protected Void doInBackground(Void... arg0)
>     {
>         System.out.println("Recording started");
>         audioRecord = null;
>         System.gc();
>         int totalBytes = bufferSize;
>         try
>         {
>             buffer = new byte[bufferSize];

I'm not an Android expert, nevertheless I have the feeling that the problem
is in the System.gc() -> new byte[bufferSize] sequence, which seems to me is
invoked at every sample cycle.

In many VM, System.gc() may be a performance killer. It may be this applies
to the LG Ally, too.

If this is the case, the duration of your sampling cycle may be too long to
sustain the sampling rate, such that the device's hardware buffer gets
overrun. Then, you're always fetching the maximum size of it, which in case
of the LG Ally could even be 1024 bytes. If your sampling cycle is long
enough, you can experience this effect regardless of the sampling rate you
use.

Instead of a "System.gc()" followed by a "new byte[]", I would instead
suggest to pre-allocate the byte array and possibly every other memory
resource you need to perform your task.

Giampaolo

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to