I have managed to get past the configuration part and interestingly enough 
I am getting the same error after successfully encoding  4 frames - on the 
5fth frame it throws IllegalStateException and the whole OMX subsystem 
crashes so badly that only reboot can fix it!!! 



On Tuesday, September 18, 2012 5:07:29 AM UTC+2, David Hagege wrote:
>
> Hi,
>
> I have a strange issue regarding the new MediaCodec API on Jellybean.
> The native function android.media.MediaCodec.native_configure is throwing 
> a java.lang.IllegalStateException.
> I'm using the OMX.TI.DUCATI1.VIDEO.H264E codec on a Galaxy Nexus (maguro).
>
> Here is my Scala code:
>
>
> class ScreenshotView(context: Context, attr: AttributeSet, style: Int)
>> extends SurfaceView(context, attr, style) with SurfaceHolder.Callback {
>> private def startEncoder = {
>> var surface = getHolder.getSurface
>> var codec: MediaCodec = MediaCodec.createEncoderByType("video/avc")
>>         codec.configure(MediaFormat.createVideoFormat("video/avc",
>>           getWidth, getHeight), surface, null, 
>> MediaCodec.CONFIGURE_FLAG_ENCODE)
>>     }
>> }
>
>  
>
>
>
> When calling the startEncoder method, the codec.configure() fails.
> Here is what I can see in the logcat:
>
> I/OMXClient( 1193): Using client-side OMX mux.
>> E/OHELP   ( 1193): CODEC:android.media.MediaCodec@42124b70
>> E/OHELP   ( 1193): MediaFormat:{height=1038, width=720, mime=video/avc}
>> E/ACodec  ( 1193): [OMX.TI.DUCATI1.VIDEO.H264E] configureCodec returning 
>> error -38
>> E/MediaCodec( 1193): Codec reported an error. (omx error 0x80001001, 
>> internalError -38)
>> D/AndroidRuntime( 1193): Shutting down VM
>> W/dalvikvm( 1193): threadid=1: thread exiting with uncaught exception 
>> (group=0x41bf3300)
>> E/AndroidRuntime( 1193): FATAL EXCEPTION: main
>> E/AndroidRuntime( 1193): java.lang.IllegalStateException
>> E/AndroidRuntime( 1193):        at 
>> android.media.MediaCodec.native_configure(Native Method)
>> E/AndroidRuntime( 1193):        at 
>> android.media.MediaCodec.configure(MediaCodec.java:257)
>
>
> If I'm looking at the JNI, here is where the exception is thrown 
> (frameworks/base/media/jni/android_media_MediaCodec.cpp:338):
>
>
> static jint throwExceptionAsNecessary(
>         JNIEnv *env, status_t err, const char *msg = NULL) {
>     if (err >= ERROR_DRM_WV_VENDOR_MIN && err <= ERROR_DRM_WV_VENDOR_MAX) {
>         // We'll throw our custom MediaCodec.CryptoException
>         throwCryptoException(env, err, msg);
>         return 0;
>     }
>     switch (err) {
>         case OK:
>             return 0;
>         case -EAGAIN:
>             return DEQUEUE_INFO_TRY_AGAIN_LATER;
>         case INFO_FORMAT_CHANGED:
>             return DEQUEUE_INFO_OUTPUT_FORMAT_CHANGED;
>         case INFO_OUTPUT_BUFFERS_CHANGED:
>             return DEQUEUE_INFO_OUTPUT_BUFFERS_CHANGED;
>         default:
>         {
>             jniThrowException(env, "java/lang/IllegalStateException", 
> NULL);   /// I'm getting there                                     
>             break;
>         }
>     }
>     return 0;
> }
>
>
> This call is made in the last line of 
> android_media_MediaCodec_native_configure() (line 389):
>
>     err = codec->configure(format, surfaceTexture, crypto, flags);
>>     throwExceptionAsNecessary(env, err);                                 
>>                                            
>
>
>
> Is there anything I'm doing wrong?
> My surface is valid (isValid() is returning true). Everything passed to 
> codec->configure() in the JNI seems to be ok too.
> Any clues?
>
> Thanks,
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to