[android-developers] Re: java.lang.IllegalStateException in Media.configure() with the new MediaCodec API

2017-01-12 Thread dt1314dt
hello, I meet the same error, have you solved it? Could you share the 
method to me?

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fcf928c2-f01d-464d-b69f-767705760f74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: java.lang.IllegalStateException in Media.configure() with the new MediaCodec API

2012-12-02 Thread ekwang
Hi guys.

You have to set several meta value for use MediaCodec Encoder.
Encoder need width, hegith, 
bitrate(KEY_BIT_RATEhttp://developer.android.com/reference/android/media/MediaFormat.html#KEY_BIT_RATE
), 
frame-rate(KEY_FRAME_RATEhttp://developer.android.com/reference/android/media/MediaFormat.html#KEY_FRAME_RATE)
 
keys value for configure.

MediaFormat mFormat = MediaFormat.createVideoFormat(video/avc,getWidth, 
getHeight);

mFormat.setInteger(KEY_BIT_RATE, value);
mFormat.setInteger(KEY_FRAME_RATE, value);

codec.configure( mFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);

Thanks.
Lee.

2012년 9월 18일 화요일 오후 12시 7분 29초 UTC+9, David Hagege 님의 말:

 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

[android-developers] Re: java.lang.IllegalStateException in Media.configure() with the new MediaCodec API

2012-11-08 Thread shakti sourav sahu
Hi folks,

I am facing the same error when I am trying to do an audio encode from WAV 
to AMR on android emulator

Here is my code.
MediaCodec codec = MediaCodec.createEncoderByType(audio/3gpp);
MediaFormat toFormat = MediaFormat.createAudioFormat(audio/3gpp, 
8000, 1);
codec.configure(toFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);

And I get the following errors. First of all it seems it can't open the 
libwvm.so file which seems suspicious.
Next it fails at the MediaCodec.configure functions.

10-31 11:20:30.333: E/WVMExtractor(18234): Failed to open libwvm.so
10-31 11:20:30.343: I/OMXClient(18234): Using client-side OMX mux.
10-31 11:20:30.363: E/ACodec(18234): [OMX.google.amrnb.encoder] 
configureCodec returning error -38
10-31 11:20:30.363: E/MediaCodec(18234): Codec reported an error. (omx 
error 0x80001001, internalError -38)
10-31 11:20:30.363: W/System.err(18234): java.lang.IllegalStateException
10-31 11:20:30.383: W/System.err(18234): at 
android.media.MediaCodec.native_configure(Native Method)
10-31 11:20:30.383: W/System.err(18234): at 
android.media.MediaCodec.configure(MediaCodec.java:257)

If anyone has got past it, please reply.

Thanks
Shakti
352 222 6866

On Monday, September 17, 2012 8:07:29 PM UTC-7, 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

[android-developers] Re: java.lang.IllegalStateException in Media.configure() with the new MediaCodec API

2012-09-27 Thread Peter Kolarov
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

[android-developers] Re: java.lang.IllegalStateException in Media.configure() with the new MediaCodec API

2012-09-21 Thread Kuanyu Chou
Hi,
I also got the same error on Galaxy Nexus and Nexus S. Is there anything 
wrong for configure?

MediaCodec codec = MediaCodec.createEncoderByType(video/avc);
codec.configure(MediaFormat.createVideoFormat(video/avc, 640, 480), null, 
null, MediaCodec.CONFIGURE_FLAG_ENCODE);
codec.start();

Error:
09-20 11:44:11.399: I/OMXClient(4117): Using client-side OMX mux.
09-20 11:44:11.411: E/ACodec(4117): [OMX.SEC.AVC.Encoder] configureCodec 
returning error -38
09-20 11:44:11.411: E/MediaCodec(4117): Codec reported an error. (omx error 
0x80001001, internalError -38)
09-20 11:44:11.411: D/AndroidRuntime(4117): Shutting down VM

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