Problems with MediaRecorder class setting audio source - setAudioSource() - unsupported parameter

Posted by arakn0 on Stack Overflow See other posts from Stack Overflow or by arakn0
Published on 2010-06-09T01:22:08Z Indexed on 2010/06/10 20:52 UTC
Read the original article Hit count: 790

Filed under:
|
|

Hello everybody,

I'm new in Android development and I have the next question/problem.

I'm playing around with the MediaRecorder class to record just audio from the microphone. I'm following the steps indicated in the official site: http://developer.android.com/reference/android/media/MediaRecorder.html

So I have a method that initializes and configure the MediaRecorder object in order to start recording. Here you have the code:


        this.mr = new MediaRecorder();
        this.mr.setAudioSource(MediaRecorder.AudioSource.MIC);
        this.mr.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
        this.mr.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
        this.mr.setOutputFile(this.path + this.fileName);
        try {
            this.mr.prepare();
        } catch (IllegalStateException e) {
            Log.d("Syso", e.toString());
            e.printStackTrace();
        } catch (IOException e) {
            Log.d("Syso", e.toString());
            e.printStackTrace();
        }

When I execute this code in the simulator, thanks to logcat, I can see that the method setAudioSource(MediaRecorder.AudioSource.MIC) gives the next error (with the tag audio_ipunt) when it is called:


ERROR/audio_input(34): unsupported parameter: x-pvmf/media-input-node/cap-config-interface;valtype=key_specific_value
ERROR/audio_input(34): VerifyAndSetParameter failed

And then when the method prepare() is called, I get the another error again:


ERROR/PVOMXEncNode(34): PVMFOMXEncNode-Audio_AMRNB::DoPrepare(): Got Component OMX.PV.amrencnb handle 

If I start to record bycalling the method start()... I get lots of messages saying:


AudioFlinger(34):RecordThread: buffer overflow

Then...after stop and release,.... I can see that a file has been created, but it doesn't seem that it been well recorderd. Anway, if i try this in a real device I can record with no problems, but I CAN'T play what I just recorded.

I gues that the key is in these errors that I've mentioned before. How can I fix them? Any suggestion or help??

Thanks in advanced!!

© Stack Overflow or respective owner

Related posts about android

Related posts about audio