When using Android, I'm losing data on an incoming USB data stream that I do not lose when reading the same device/stream in Windows. (I know that Android is not a real-time OS, but neither is Windows, and Windows is having no problem 'keeping up' with the data.)
I have data coming in at about 3.5MB/sec using an FTDI 2232H chip which has a built in 4K buffer. The bulk_transfer calls in libusb can ask for 16K at a time, so Android needs to reap the contents of the USB buffer every 4ms or so.
I have tried: writing in Java and in C, raising the thread (and/or process) priority to it's highest, sync and async routines, and I even pass a separate buffer for each USB read so I don't even have to copy data between successive reads. (There is no garbage collection going on during the transfer.) I only need to buffer 20MB of data, so it's all to RAM.
Still, Android is 'not getting around' to the USB data, sometimes waiting as long as 12ms between reads, causing a bunch of data to be lost.
Does anyone have any ideas? DMA? Some sort of 'real-time' request to the kernel?