Search code examples
javaandroidaudiorecord

Error in AudioRecord - Android


I am trying to record sound on my mobile device in various configurations. For this I travel a vector of frequencies, a channel vector and a vector of audio formats.

 private static int[] mSampleRates = new int[] { 8000, 11025, 22050, 44100 };
    private static int[] mAudioFormats=new int[] { AudioFormat.ENCODING_PCM_8BIT, AudioFormat.ENCODING_PCM_16BIT };
    private static int[] mChannels=new int[]{ AudioFormat.CHANNEL_IN_MONO, AudioFormat.CHANNEL_IN_STEREO };
    public void findAudioRecord(){
        for (int i=0;i<mSampleRates.length;i++){
            for (int j=0;j<mAudioFormats.length;j++){
                for (int z=0;z<mChannels.length ;z++) {
                    try {
                        Log.e("TAG", "Try " + mSampleRates[i] + "Hz, bits: " + mAudioFormats[j] + ", channel: "
                                + mChannels[z]);
                        int bufferSize = AudioRecord.getMinBufferSize(mSampleRates[i], mAudioFormats[j], mChannels[z]);

                        if (bufferSize != AudioRecord.ERROR_BAD_VALUE) {
                            // check if we can instantiate and have a success
                            AudioRecord recorder = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, mSampleRates[i],mChannels[z], mAudioFormats[j], bufferSize);

                            if (recorder.getState() == AudioRecord.STATE_INITIALIZED)
                                Log.e("TAG", "OK");

                        }else{
                            Log.e("TAG", "Error");

                        }
                    } catch (Exception e) {
                        Log.e("TAG", mSampleRates[i] + "Exception, keep trying.",e);
                    }
                }
            }
        }

    }

In the results, I find that any configuration is valid. My mobile device is a ZOPO ZP998. Where is the error?

1-26 19:05:27.586  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 386: Landroid/content/res/TypedArray;.getType (I)I
11-26 19:05:27.586  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 2, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 2, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 2, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 2, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 2, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 2, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 3, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 3, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 2, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 2, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.639  18092-18092/ugr.mohabb.audiorecorderexample V/PhoneWindow﹕ DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.impl.PhoneWindow$DecorView{41b6e198 I.E..... R.....ID 0,0-0,0}

The complet Log. I use Android Studio.

11-26 19:05:27.462  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ Zygote::ForkAndSpecialize : 0
11-26 19:05:27.463  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ zygote get new systemTid : 18092
11-26 19:05:27.463  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ Late-enabling CheckJNI
11-26 19:05:27.465  18092-18095/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=2: interp stack at 0x71e8c000
11-26 19:05:27.466  18092-18097/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=3: interp stack at 0x71fac000
11-26 19:05:27.466  18092-18097/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ Elevating priority from 0 to -8
11-26 19:05:27.466  18092-18092/ugr.mohabb.audiorecorderexample D/jdwp﹕ prepping for JDWP over ADB
11-26 19:05:27.467  18092-18099/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=4: interp stack at 0x720cc000
11-26 19:05:27.467  18092-18099/ugr.mohabb.audiorecorderexample D/jdwp﹕ JDWP: thread running
11-26 19:05:27.468  18092-18099/ugr.mohabb.audiorecorderexample D/jdwp﹕ trying to receive file descriptor from ADB
11-26 19:05:27.468  18092-18100/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=5: interp stack at 0x74210000
11-26 19:05:27.468  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ zygote get thread init done
11-26 19:05:27.469  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create interp thread : stack size=128KB
11-26 19:05:27.469  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create new thread
11-26 19:05:27.469  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ new thread created
11-26 19:05:27.469  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ update thread list
11-26 19:05:27.469  18092-18101/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=6: interp stack at 0x74230000
11-26 19:05:27.469  18092-18101/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=6: created from interp
11-26 19:05:27.469  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ start new thread
11-26 19:05:27.469  18092-18101/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=6: notify debugger
11-26 19:05:27.469  18092-18101/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=6 (ReferenceQueueDaemon): calling run()
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create interp thread : stack size=128KB
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create new thread
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ new thread created
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ update thread list
11-26 19:05:27.470  18092-18102/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=7: interp stack at 0x74350000
11-26 19:05:27.470  18092-18102/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=7: created from interp
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ start new thread
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create interp thread : stack size=128KB
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ create new thread
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ new thread created
11-26 19:05:27.470  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ update thread list
11-26 19:05:27.471  18092-18103/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=8: interp stack at 0x74470000
11-26 19:05:27.471  18092-18103/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=8: created from interp
11-26 19:05:27.471  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ start new thread
11-26 19:05:27.471  18092-18103/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=8: notify debugger
11-26 19:05:27.471  18092-18103/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=8 (FinalizerWatchdogDaemon): calling run()
11-26 19:05:27.471  18092-18102/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=7: notify debugger
11-26 19:05:27.471  18092-18102/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=7 (FinalizerDaemon): calling run()
11-26 19:05:27.477  18092-18099/ugr.mohabb.audiorecorderexample D/jdwp﹕ received file descriptor 34 from ADB
11-26 19:05:27.480  18092-18104/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=9: interp stack at 0x7488e000
11-26 19:05:27.481  18092-18105/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ threadid=10: interp stack at 0x749ae000
11-26 19:05:27.514  18092-18092/ugr.mohabb.audiorecorderexample D/ActivityThread﹕ hoder:android.app.IActivityManager$ContentProviderHolder@41b5f3f8,provider,holder.Provider:android.content.ContentProviderProxy@41b5fb60
11-26 19:05:27.525  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ open_cached_dex_file : /data/app/ugr.mohabb.audiorecorderexample-2.apk /data/dalvik-cache/data@app@ugr.mohabb.audiorecorderexample-2.apk@classes.dex
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample I/dalvikvm﹕ Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 11350: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample I/dalvikvm﹕ Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 11356: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
11-26 19:05:27.578  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6f at 0x0000
11-26 19:05:27.579  18092-18092/ugr.mohabb.audiorecorderexample I/dalvikvm﹕ Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
11-26 19:05:27.579  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 9044: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
11-26 19:05:27.579  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x000e
11-26 19:05:27.585  18092-18092/ugr.mohabb.audiorecorderexample I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.internal.widget.TintTypedArray.getChangingConfigurations
11-26 19:05:27.585  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 364: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
11-26 19:05:27.585  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-26 19:05:27.586  18092-18092/ugr.mohabb.audiorecorderexample I/dalvikvm﹕ Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.internal.widget.TintTypedArray.getType
11-26 19:05:27.586  18092-18092/ugr.mohabb.audiorecorderexample W/dalvikvm﹕ VFY: unable to resolve virtual method 386: Landroid/content/res/TypedArray;.getType (I)I
11-26 19:05:27.586  18092-18092/ugr.mohabb.audiorecorderexample D/dalvikvm﹕ VFY: replacing opcode 0x6e at 0x0002
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 2, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 8000Hz, bits: 2, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 2, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 11025Hz, bits: 2, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 3, channel: 16
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 3, channel: 12
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.629  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 2, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 22050Hz, bits: 2, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 3, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 3, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 2, channel: 16
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Try 44100Hz, bits: 2, channel: 12
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/AudioRecord-Java﹕ [ android.media.AudioRecord ] getMinBufferSize(): Invalid audio format.
11-26 19:05:27.630  18092-18092/ugr.mohabb.audiorecorderexample E/TAG﹕ Error
11-26 19:05:27.639  18092-18092/ugr.mohabb.audiorecorderexample V/PhoneWindow﹕ DecorView setVisiblity: visibility = 4 ,Parent =null, this =com.android.internal.policy.impl.PhoneWindow$DecorView{41b6e198 I.E..... R.....ID 0,0-0,0}
11-26 19:05:27.648  18092-18092/ugr.mohabb.audiorecorderexample V/ViewRootImpl﹕ scheduleConsumeBatchedInput: mConsumeBatchedInputScheduled = false,mFirstPendingInputEvent = null, this = ViewRoot{41bad600 ugr.mohabb.audiorecorderexample/ugr.mohabb.audiorecorderexample.MainActivity,ident = 0}
11-26 19:05:27.651  18092-18092/ugr.mohabb.audiorecorderexample V/PhoneWindow﹕ DecorView setVisiblity: visibility = 0 ,Parent =ViewRoot{41bad600 ugr.mohabb.audiorecorderexample/ugr.mohabb.audiorecorderexample.MainActivity,ident = 0}, this =com.android.internal.policy.impl.PhoneWindow$DecorView{41b6e198 V.E..... R.....ID 0,0-0,0}
11-26 19:05:27.652  18092-18092/ugr.mohabb.audiorecorderexample V/ViewRootImpl﹕ doConsumeBatchedInput: frameTimeNanos = 93765580188633, this = ViewRoot{41bad600 ugr.mohabb.audiorecorderexample/ugr.mohabb.audiorecorderexample.MainActivity,ident = 0}
11-26 19:05:27.682  18092-18092/ugr.mohabb.audiorecorderexample D/libEGL﹕ >>> 0 0 android
11-26 19:05:27.682  18092-18092/ugr.mohabb.audiorecorderexample D/libEGL﹕ >>> 0 1 mali
11-26 19:05:27.687  18092-18092/ugr.mohabb.audiorecorderexample D/libEGL﹕ loaded /system/lib/egl/libEGL_mali.so
11-26 19:05:27.692  18092-18092/ugr.mohabb.audiorecorderexample D/libEGL﹕ loaded /system/lib/egl/libGLESv1_CM_mali.so
11-26 19:05:27.695  18092-18092/ugr.mohabb.audiorecorderexample D/libEGL﹕ loaded /system/lib/egl/libGLESv2_mali.so
11-26 19:05:27.711  18092-18092/ugr.mohabb.audiorecorderexample E/linker﹕ load_library(linker.cpp:764): library "libmaliinstr.so" not found
11-26 19:05:27.715  18092-18092/ugr.mohabb.audiorecorderexample E/﹕ appName=ugr.mohabb.audiorecorderexample, acAppName=com.android.cts.openglperf
11-26 19:05:27.715  18092-18092/ugr.mohabb.audiorecorderexample E/﹕ 0
11-26 19:05:27.716  18092-18092/ugr.mohabb.audiorecorderexample E/﹕ appName=ugr.mohabb.audiorecorderexample, acAppName=com.android.browser
11-26 19:05:27.716  18092-18092/ugr.mohabb.audiorecorderexample E/﹕ 0
11-26 19:05:27.724  18092-18092/ugr.mohabb.audiorecorderexample D/GraphicBuffer﹕ create handle(0x7352fa20) (w:1088, h:1920, f:1)
11-26 19:05:27.727  18092-18092/ugr.mohabb.audiorecorderexample I/MALI﹕ [Mali]surface->num_buffers=4, surface->num_frames=3, win_min_undequeued=1
11-26 19:05:27.727  18092-18092/ugr.mohabb.audiorecorderexample I/MALI﹕ [Mali]max_allowed_dequeued_buffers=3
11-26 19:05:27.728  18092-18092/ugr.mohabb.audiorecorderexample D/GraphicBuffer﹕ close handle(0x7352fa20) (w:1088 h:1920 f:1)
11-26 19:05:27.734  18092-18092/ugr.mohabb.audiorecorderexample D/GraphicBuffer﹕ create handle(0x73518bf8) (w:1088, h:1920, f:1)
11-26 19:05:27.746  18092-18092/ugr.mohabb.audiorecorderexample D/OpenGLRenderer﹕ Enabling debug mode 0
11-26 19:05:27.749  18092-18092/ugr.mohabb.audiorecorderexample V/ViewRootImpl﹕ scheduleConsumeBatchedInput: mConsumeBatchedInputScheduled = false,mFirstPendingInputEvent = null, this = ViewRoot{41bad600 ugr.mohabb.audiorecorderexample/ugr.mohabb.audiorecorderexample.MainActivity,ident = 0}
11-26 19:05:27.772  18092-18092/ugr.mohabb.audiorecorderexample V/InputMethodManager﹕ onWindowFocus: null softInputMode=288 first=true flags=#1810100
11-26 19:05:27.772  18092-18092/ugr.mohabb.audiorecorderexample V/InputMethodManager﹕ START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{41b6e198 V.E..... R.....ID 0,0-1080,1920} ic=null tba=android.view.inputmethod.EditorInfo@41bbd138 controlFlags=#104
11-26 19:05:27.775  18092-18092/ugr.mohabb.audiorecorderexample V/InputMethodManager﹕ Starting input: Bind result=InputBindResult{null com.android.inputmethod.latin/.LatinIME #1116}
11-26 19:05:27.775  18092-18092/ugr.mohabb.audiorecorderexample V/ViewRootImpl﹕ doConsumeBatchedInput: frameTimeNanos = 93765685299709, this = ViewRoot{41bad600 ugr.mohabb.audiorecorderexample/ugr.mohabb.audiorecorderexample.MainActivity,ident = 0}
11-26 19:05:45.612  18092-18092/ugr.mohabb.audiorecorderexample V/InputMethodManager﹕ START INPUT: com.android.internal.policy.impl.PhoneWindow$DecorView{41b6e198 V.E..... R.....I. 0,0-1080,1920} ic=null tba=android.view.inputmethod.EditorInfo@41bc21f0 controlFlags=#100
11-26 19:05:45.614  18092-18092/ugr.mohabb.audiorecorderexample V/InputMethodManager﹕ Starting input: Bind result=InputBindResult{com.android.internal.view.IInputMethodSession$Stub$Proxy@41bc2b50 com.android.inputmethod.latin/.LatinIME #1117}

Solution

  • getMinBufferSize() does not support 8BIT PCM ENCODING(see https://www.codeaurora.org/cgit/quic/la//platform/frameworks/base/tree/media/java/android/media/AudioRecord.java?id=refs/heads/jb_mr1#l477 at #499)