INDExOS / media-for-mobile

Media for Mobile
Other
456 stars 176 forks source link

EGL14.eglMakeCurrent in InputSurface.java freezes on Nexus 7 (2012) #74

Closed sjvc closed 7 years ago

sjvc commented 7 years ago

It's tested on a Nexus 7 (2012) with Android 4.4.4 and 5.0

This is from adb bugreport:

"Thread-597" prio=5 tid=76 Native
  | group="main" sCount=1 dsCount=0 obj=0x12d44190 self=0x80858858
  | sysTid=7984 nice=0 cgrp=apps sched=0/0 handle=0x80858d38
  | state=S schedstat=( 43302000 35740000 115 ) utm=2 stm=2 core=3 HZ=100
  | stack=0x80c74000-0x80c76000 stackSize=1036KB
  | held mutexes=
  native: #00 pc 00012444  /system/lib/libc.so (syscall+28)
  native: #01 pc 0001641b  /system/lib/libc.so (???)
  native: #02 pc 000167b1  /system/lib/libc.so (pthread_mutex_lock+310)
  native: #03 pc 00005b5c  /system/lib/libnvos.so (???)
  native: #04 pc 0000a7d8  /system/lib/egl/libGLESv2_tegra.so (???)
  native: #05 pc 00006ee3  /system/lib/egl/libEGL_tegra.so (???)
  native: #06 pc 00006f8f  /system/lib/egl/libEGL_tegra.so (???)
  native: #07 pc 000077db  /system/lib/egl/libEGL_tegra.so (eglMakeCurrent+34)
  native: #08 pc 0000ffc1  /system/lib/libEGL.so (android::egl_display_t::makeCurrent(android::egl_context_t*, android::egl_context_t*, void*, void*, void*, void*, void*, void*)+142)
  native: #09 pc 000125cf  /system/lib/libEGL.so (eglMakeCurrent+266)
  native: #10 pc 0005fffb  /system/lib/libandroid_runtime.so (???)
  native: #11 pc 00271ed3  /data/dalvik-cache/arm/system@framework@boot.oat (Java_com_google_android_gles_1jni_EGLImpl_eglMakeCurrent__Ljavax_microedition_khronos_egl_EGLDisplay_2Ljavax_microedition_khronos_egl_EGLSurface_2Ljavax_microedition_khronos_egl_EGLSurface_2Ljavax_microedition_khronos_egl_EGLContext_2+178)
  at com.google.android.gles_jni.EGLImpl.eglMakeCurrent(Native method)
  at com.mycopmany.mypackage.androidvideocapture.SharedContext.doneCurrent(SharedContext.java:104)
  at com.mycopmany.mypackage.androidvideocapture.Capturing$EncodeThread.run(Capturing.java:104)
  - locked <@addr=0x12f01780> (a com.mycopmany.mypackage.androidvideocapture.VideoCapture)

"Thread-602" prio=5 tid=82 Native
  | group="main" sCount=1 dsCount=0 obj=0x12dd5c50 self=0x7f2c42b0
  | sysTid=6302 nice=0 cgrp=apps sched=0/0 handle=0x7f2d5020
  | state=S schedstat=( 17164000 17265000 48 ) utm=0 stm=1 core=1 HZ=100
  | stack=0x81402000-0x81404000 stackSize=1036KB
  | held mutexes=
  native: #00 pc 00012444  /system/lib/libc.so (syscall+28)
  native: #01 pc 0001641b  /system/lib/libc.so (???)
  native: #02 pc 000167b1  /system/lib/libc.so (pthread_mutex_lock+310)
  native: #03 pc 00005b5c  /system/lib/libnvos.so (???)
  native: #04 pc 0000b64c  /system/lib/egl/libGLESv2_tegra.so (???)
  native: #05 pc 00007219  /system/lib/egl/libEGL_tegra.so (???)
  native: #06 pc 000077db  /system/lib/egl/libEGL_tegra.so (eglMakeCurrent+34)
  native: #07 pc 0000ff93  /system/lib/libEGL.so (android::egl_display_t::makeCurrent(android::egl_context_t*, android::egl_context_t*, void*, void*, void*, void*, void*, void*)+96)
  native: #08 pc 000125cf  /system/lib/libEGL.so (eglMakeCurrent+266)
  native: #09 pc 00061845  /system/lib/libandroid_runtime.so (???)
  native: #10 pc 009bf213  /data/dalvik-cache/arm/system@framework@boot.oat (Java_android_opengl_EGL14_eglMakeCurrent__Landroid_opengl_EGLDisplay_2Landroid_opengl_EGLSurface_2Landroid_opengl_EGLSurface_2Landroid_opengl_EGLContext_2+178)
  at android.opengl.EGL14.eglMakeCurrent(Native method)
  at org.m4m.android.InputSurface.makeCurrent(InputSurface.java:145)
  at org.m4m.android.Surface.<init>(Surface.java:34)
  at org.m4m.android.MediaCodecEncoderPlugin.createInputSurface(MediaCodecEncoderPlugin.java:133)
  at org.m4m.domain.Encoder.getSurface(Encoder.java:34)
  at org.m4m.domain.pipeline.PluginConnector$26.onSurfaceAvailable(PluginConnector.java:354)
  at org.m4m.android.GameCapturerSource.setSurfaceSize(GameCapturerSource.java:52)
  at org.m4m.GLCapture.setSurfaceSize(GLCapture.java:89)
  at com.mycopmany.mypackage.androidvideocapture.VideoCapture.configure(VideoCapture.java:93)
  at com.mycopmany.mypackage.androidvideocapture.VideoCapture.beginCaptureFrame(VideoCapture.java:104)
  at com.mycopmany.mypackage.androidvideocapture.Capturing$EncodeThread.run(Capturing.java:96)
  - locked <@addr=0x12db64a0> (a com.mycopmany.mypackage.androidvideocapture.VideoCapture)

As you can see, both threads are locked.

There is a bug in Tegra drivers that causes a deadlock when using shared contexts. More info:

sjvc commented 7 years ago

I'm closing it because it's not directly related with this library, but with an Intel's tutorial about using this library: https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials-video-capturing-for-unity3d-applications