eglMakeCurrent failed EGL

I've made a video chat application which is running fine on every device i've ever encountered until now.

The offending device is a Samsung Galaxy Tab 4 7" (model no. SM-T230).

I'm using the MediaCodec API and i'm using the input surface technique.

I have a SurfaceView which covers the full screen and is used to render a downstream video feed and I have a GLSurfaceView overlaid on top of it which is used to render the local camera input and also frames feed into the MediaCodec.

I'm largely using the techniques demonstrated in the MediaCodec samples in the Grafika application from http://bigflake.com/mediacodec/.

On this particular device i'm getting a crash as soon as my encoder class calls MediaCodec.getOutputBuffers();

Here is the Logcat:

06-08 14:48:41.721 19234-19234 D/GlUtil: EGLContext created, client version 0
06-08 14:48:41.721 19234-19341 D/GC: <tid=19341> OES20 ===> GC Version   : GC Ver rls_pxa988_KK44_GC13.25 
06-08 14:48:41.791 19234-19341 D/CameraSurfaceRenderer: onSurfaceCreated
06-08 14:48:41.811 19234-19341 D/GlUtil: Created program 3 (TEXTURE_EXT)
06-08 14:48:41.811 19234-19341 D/CameraSurfaceRenderer: onSurfaceChanged 266x325
06-08 14:48:41.811 19234-19234 I/ACodec:  [] Now uninitialized
06-08 14:48:41.811 19234-19343 I/OMXClient: Using client-side OMX mux.
06-08 14:48:41.821 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Loaded
06-08 14:48:41.821 19234-19343 E/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] storeMetaDataInBuffers failed w/ err -2147483648
06-08 14:48:41.821 19234-19343 I/ACodec: DRC Mode: Port Reconfig Mode
06-08 14:48:41.821 19234-19343 I/ACodec: set min input buffer size as estimated 626688 bytes(w:768, h:1088).
06-08 14:48:41.831 19234-19341 D/CameraSurfaceRenderer: changeRecordingState: was false now true
06-08 14:48:41.831 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Loaded->Idle
06-08 14:48:41.831 19234-19343 I/ACodec: Native Window Buffer Geometry 768.1088 - OMX_COLOR_FormatYUV420Planar
06-08 14:48:41.831 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Allocating 6 buffers from a native window of size 1253376 on output port
06-08 14:48:41.841 19234-19234 D/VideoDecoder: Decoder name: OMX.MARVELL.VIDEO.HW.CODA7542DECODER
06-08 14:48:41.841 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Idle->Executing
06-08 14:48:41.851 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Executing
06-08 14:48:41.851 19234-19234 I/ACodec:  [] Now uninitialized
06-08 14:48:41.851 19234-19347 I/OMXClient: Using client-side OMX mux.
06-08 14:48:41.931 19234-19347 I/ACodec: [OMX.google.aac.encoder] Now Loaded
06-08 14:48:41.931 19234-19347 I/OMXNodeInstance: OMX_GetExtensionIndex OMX.google.android.index.enableAndroidNativeBuffers failed, turn to mrvl method
06-08 14:48:41.931 19234-19347 I/ACodec: [OMX.google.aac.encoder] Now Loaded->Idle
06-08 14:48:41.931 19234-19347 I/ACodec: [OMX.google.aac.encoder] Now Idle->Executing
06-08 14:48:41.931 19234-19347 I/ACodec: [OMX.google.aac.encoder] Now Executing
06-08 14:48:41.931 19234-19234 D/AacEldEncoder: encoder configured after :8
06-08 14:48:41.931 19234-19234 D/downstreamSurface: surface changed
06-08 14:48:42.011 19234-19234 E/libEGL: eglMakeCurrent:779 error 3002 (EGL_BAD_ACCESS)
06-08 14:48:42.011 19234-19234 E/HardwareRenderer: eglMakeCurrent failed EGL_BAD_ACCESS
06-08 14:48:42.011 19234-19234 W/HardwareRenderer: Mountain View, we've had a problem here. Switching back to software rendering.
06-08 14:48:42.272 19234-19234 E/libEGL: eglMakeCurrent:779 error 3002 (EGL_BAD_ACCESS)
06-08 14:48:42.272 19234-19234 E/HardwareRenderer: eglMakeCurrent failed EGL_BAD_ACCESS
06-08 14:48:42.272 19234-19234 W/HardwareRenderer: Mountain View, we've had a problem here. Switching back to software rendering.
06-08 14:48:42.282 19234-19234 E/libEGL: eglMakeCurrent:779 error 3002 (EGL_BAD_ACCESS)
06-08 14:48:42.372 19234-19234 V/MediaPlayer-JNI: native_setup
06-08 14:48:42.372 19234-19234 V/MediaPlayer: constructor
06-08 14:48:42.372 19234-19234 V/MediaPlayer: setListener
06-08 14:48:42.372 19234-19234 V/MediaPlayer-JNI: setDataSourceFD: fd 79
06-08 14:48:42.372 19234-19234 V/MediaPlayer: setDataSource(79, 2824640, 2401066)
06-08 14:48:42.382 19234-19245 V/MediaPlayer: message received msg=8, ext1=0, ext2=0
06-08 14:48:42.382 19234-19245 V/MediaPlayer: notify(8, 0, 0) callback on disconnected mediaplayer
06-08 14:48:42.412 19234-19234 V/MediaPlayer: setVideoSurfaceTexture
06-08 14:48:42.412 19234-19234 V/MediaPlayer: prepare
06-08 14:48:42.412 19234-19246 V/MediaPlayer: message received msg=200, ext1=973, ext2=0
06-08 14:48:42.412 19234-19246 W/MediaPlayer: info/warning (973, 0)
06-08 14:48:42.412 19234-19246 V/MediaPlayer: callback application
06-08 14:48:42.412 19234-19246 V/MediaPlayer: back from callback
06-08 14:48:42.412 19234-19245 V/MediaPlayer: message received msg=5, ext1=0, ext2=0
06-08 14:48:42.412 19234-19245 V/MediaPlayer: New video size 0 x 0
06-08 14:48:42.412 19234-19245 V/MediaPlayer: callback application
06-08 14:48:42.412 19234-19245 V/MediaPlayer: back from callback
06-08 14:48:42.412 19234-19246 V/MediaPlayer: message received msg=1, ext1=0, ext2=0
06-08 14:48:42.412 19234-19246 V/MediaPlayer: prepared
06-08 14:48:42.412 19234-19246 V/MediaPlayer: signal application thread
06-08 14:48:42.412 19234-19246 V/MediaPlayer: callback application
06-08 14:48:42.412 19234-19246 V/MediaPlayer: back from callback
06-08 14:48:42.412 19234-19234 V/MediaPlayer: prepare complete - status=0
06-08 14:48:42.412 19234-19234 V/MediaPlayer-JNI: setAudioStreamType: 3
06-08 14:48:42.412 19234-19234 V/MediaPlayer: MediaPlayer::setAudioStreamType
06-08 14:48:42.412 19234-19234 V/MediaPlayer-JNI: start
06-08 14:48:42.412 19234-19234 V/MediaPlayer: start
06-08 14:48:42.442 19234-19245 V/MediaPlayer: message received msg=6, ext1=0, ext2=0
06-08 14:48:42.442 19234-19234 I/MediaPlayer: Don't send intent. msg.arg1 = 0, msg.arg2 = 0
06-08 14:48:42.442 19234-19234 E/MediaPlayer: Should have subtitle controller already set
06-08 14:48:42.442 19234-19245 V/MediaPlayer: Received MEDIA_STARTED
06-08 14:48:42.442 19234-19245 V/MediaPlayer: callback application
06-08 14:48:42.442 19234-19245 V/MediaPlayer: back from callback
06-08 14:48:42.442 19234-19234 V/MediaPlayer-JNI: getCurrentPosition: 149 (msec)
06-08 14:48:42.442 19234-19234 V/MediaPlayer-JNI: isPlaying: 1
06-08 14:48:42.552 19234-19341 D/TextureMovieEncoder: Encoder: startRecording()
06-08 14:48:42.562 19234-19371 D/TextureMovieEncoder: handleStartRecording EncoderConfig: 288x352 to '' ctxt=android.opengl.EGLContext@82292fb0
06-08 14:48:42.562 19234-19371 D/VideoEncoderCore: format: {frame-rate=15, bitrate=0, height=352, mime=video/avc, color-format=2130708361, i-frame-interval=600, width=288}
06-08 14:48:42.562 19234-19371 I/ACodec:  [] Now uninitialized
06-08 14:48:42.562 19234-19373 I/OMXClient: Using client-side OMX mux.
06-08 14:48:42.562 19234-19373 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] Now Loaded
06-08 14:48:42.572 19234-19373 E/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] storeMetaDataInBuffers (output) failed w/ err -2147483648
06-08 14:48:42.572 19234-19373 I/ACodec: setupVideoEncoder succeeded
06-08 14:48:42.572 19234-19373 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] Now Loaded->Idle
06-08 14:48:42.582 19234-19373 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] Now Idle->Executing
06-08 14:48:42.582 19234-19373 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] Now Executing
06-08 14:48:42.642 19234-19371 D/GC: <tid=19371> OES20 ===> GC Version   : GC Ver rls_pxa988_KK44_GC13.25 
06-08 14:48:42.702 19234-19371 D/GlUtil: EGLContext created, client version 0
06-08 14:48:42.722 19234-19371 D/GlUtil: Created program 6 (TEXTURE_EXT)
06-08 14:48:42.722 19234-19371 D/VideoEncoderCore: drainEncoder(false)
06-08 14:48:42.752 19234-19373 E/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542ENCODER] ERROR(0x80001000)
06-08 14:48:42.752 19234-19372 E/MediaCodec: Codec reported an error. (omx error 0x80001000, internalError -2147483648)
06-08 14:48:42.752 19234-19371 D/VideoEncoderCore: drainEncoder(false)
06-08 14:48:42.752 19234-19371 W/dalvikvm: threadid=73: thread exiting with uncaught exception (group=0x417e1c08)
06-08 14:48:42.762 19234-19371 E/AndroidRuntime: FATAL EXCEPTION: TextureMovieEncoder
                                                 Process: com.wizix.gridme.dev, PID: 19234
                                                 java.lang.IllegalStateException
                                                     at android.media.MediaCodec.getBuffers(Native Method)
                                                     at android.media.MediaCodec.getOutputBuffers(MediaCodec.java:551)
                                                     at com.wizix.videoencoder.video.VideoEncoderCore.drainEncoder(VideoEncoderCore.java:199)
                                                     at com.wizix.videoencoder.video.TextureMovieEncoder.handleFrameAvailable(TextureMovieEncoder.java:280)
                                                     at com.wizix.videoencoder.video.TextureMovieEncoder.access$200(TextureMovieEncoder.java:55)
                                                     at com.wizix.videoencoder.video.TextureMovieEncoder$EncoderHandler.handleMessage(TextureMovieEncoder.java:491)
                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                     at android.os.Looper.loop(Looper.java:146)
                                                     at com.wizix.videoencoder.video.TextureMovieEncoder.run(TextureMovieEncoder.java:241)
                                                     at java.lang.Thread.run(Thread.java:841)
06-08 14:48:42.942 19234-19234 D/CameraWrapper: releaseCameras -- done
06-08 14:48:42.942 19234-19341 D/CameraSurfaceRenderer: renderer pausing -- releasing SurfaceTexture
06-08 14:48:42.952 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Executing->Idle
06-08 14:48:42.972 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Idle->Loaded
06-08 14:48:42.972 19234-19343 I/ACodec: [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now Loaded
06-08 14:48:43.002 19234-19234 D/downstreamSurface: surface destroyed
06-08 14:48:43.002 19234-19234 V/MediaPlayer-JNI: isPlaying: 1
06-08 14:48:43.002 19234-19234 V/MediaPlayer-JNI: stop
06-08 14:48:43.002 19234-19234 V/MediaPlayer: stop
06-08 14:48:43.002 19234-19370 V/MediaPlayer: message received msg=7, ext1=0, ext2=0
06-08 14:48:43.012 19234-19370 V/MediaPlayer: unrecognized message: (7, 0, 0)
06-08 14:48:43.012 19234-19370 V/MediaPlayer: callback application
06-08 14:48:43.012 19234-19370 V/MediaPlayer: back from callback
06-08 14:48:43.203 19234-19343 I/ACodec:  [OMX.MARVELL.VIDEO.HW.CODA7542DECODER] Now uninitialized

I tried running the Grafika application and interestingly I also had some issues with it. For instance, on the Play Video (SurfaceView) sample I get the following every time I close the activity after playing the video:

06-08 14:57:57.163 27232-27232/com.android.grafika E/AndroidRuntime: FATAL EXCEPTION: main
                                                                     Process: com.android.grafika, PID: 27232
                                                                     java.lang.IllegalStateException: eglMakeCurrent failed EGL_BAD_ACCESS
                                                                         at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1354)
                                                                         at android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:1241)
                                                                         at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:1058)
                                                                         at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
                                                                         at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
                                                                         at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6529)
                                                                         at android.view.Choreographer$CallbackRecord.run(Choreographer.java:812)
                                                                         at android.view.Choreographer.doCallbacks(Choreographer.java:612)
                                                                         at android.view.Choreographer.doFrame(Choreographer.java:582)
                                                                         at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:798)
                                                                         at android.os.Handler.handleCallback(Handler.java:733)
                                                                         at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                         at android.os.Looper.loop(Looper.java:146)
                                                                         at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                                         at java.lang.reflect.Method.invokeNative(Native Method)
                                                                         at java.lang.reflect.Method.invoke(Method.java:515)
                                                                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                                         at dalvik.system.NativeStart.main(Native Method)

Even the simple OpenGL ES Info crashes consistently every time with the following:

06-08 15:01:54.695 628-628/com.android.grafika E/AndroidRuntime: FATAL EXCEPTION: main
                                                                 Process: com.android.grafika, PID: 628
                                                                 java.lang.IllegalStateException: eglMakeCurrent failed EGL_BAD_ACCESS
                                                                     at android.view.HardwareRenderer$GlRenderer.createSurface(HardwareRenderer.java:1354)
                                                                     at android.view.HardwareRenderer$GlRenderer.createEglSurface(HardwareRenderer.java:1241)
                                                                     at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:1058)
                                                                     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1867)
                                                                     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
                                                                     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6529)
                                                                     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:812)
                                                                     at android.view.Choreographer.doCallbacks(Choreographer.java:612)
                                                                     at android.view.Choreographer.doFrame(Choreographer.java:582)
                                                                     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:798)
                                                                     at android.os.Handler.handleCallback(Handler.java:733)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                     at android.os.Looper.loop(Looper.java:146)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5602)
                                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
                                                                     at dalvik.system.NativeStart.main(Native Method)

The Show + capture camera sample seems to work fine so i'm wondering if my issue is caused by having multiple SurfaceViews/GLSurfaceViews.

链接地址: http://www.djcxy.com/p/92544.html

上一篇: 为什么使用MediaCodec制作的视频乱码为Samsung Galaxy S7?

下一篇: eglMakeCurrent失败EGL