INDExOS / media-for-mobile

Media for Mobile
Other
457 stars 176 forks source link

AudioRecord-JNI: Error -4 during AudioRecord native read #14

Open flaquir4 opened 8 years ago

flaquir4 commented 8 years ago

sometimes when I stop the record I get this error message " AudioRecord-JNI: Error -4 during AudioRecord native read" I searched it but i found nothing.

bennnjamin commented 8 years ago

Browsing the Android source, it looks like that message is printed in this function:

https://github.com/android/platform_frameworks_base/blob/master/core/jni/android_media_AudioRecord.cpp#L434

It looks like it's a result of reading an invalid amount of data from the audio driver. I believe the particular error code is available through the API here:

[http://developer.android.com/reference/android/media/AudioRecord.html#read(short[], int, int)](http://developer.android.com/reference/android/media/AudioRecord.html#read%28short[], int, int%29)

Ehtasha commented 5 years ago

Mostly this error come when we are not using recorder.stop(); recorder.release();

Must release the object when recording is stop.