AudioRecord read() does not return same amount of bytes as requested in sizeInBytes
I have built voice recording feature in my app and have launched it in production for few months. From error logs, I have found that sometimes, the read() method in AudioRecord will return different number of bytes than indicated in sizeInBytes argument.
public int read(byte[] audioData, int offsetInBytes, int sizeInBytes)
Below is the code snippet to help understand better.
val audioRecordData = ByteArray(bufferSize)
val length = audioRecord.read(audioRecordData, 0, audioRecordData.size)
if...