我在一個ListView中有多個TextureView,它可以播放opengl視頻流。該代碼適用於Nexus 4(4.2),Galaxy S3(4.1)和HTC One(4.0.3)。然而,當我嘗試在opengl線程運行時(死鎖)嘗試在S2(SPH-D710VMUB,Virgin Mobile,4.0.4)上滾動列表視圖時,會發生ANR。 ANR跟蹤在下面提供(在listview中isHardwareAccelerated()= true)。在Galaxy S2上的ANR TextureView(GPU驅動程序問題?)
另外請注意,如果使用GLSurfaceView來處理相同的OpenGL代碼,它可以正常工作,但Z-order在ICS設備的同一個窗口中混淆了多個SurfaceViews。 GLTextureView通過指令轉換Converting from GLSurfaceView to TextureView (via GLTextureView)
編輯1:試過GLTextureView的另一個實現,能夠找到確切的線。 「eglSwapBuffers(EGLDisplay display,EGLSurface surface);」會出於某種原因阻止S2。
有人注意到:http://vec.io/posts/a-workaround-to-fix-opengl-eglswapbuffers-freezing glFinish();是必要的。任何想法?編輯2:添加glFinish()或eglWaitGL()並不能幫助。 :(嫌疑人立即不管他們返回....
編輯3:重現它使用https://github.com/eaglesakura/gltextureview: 見https://github.com/eaglesakura/gltextureview/issues/1
編輯4:如果你想知道,這是我實現GLTextureView的(https://github.com/edisonw/jjmpeg/tree/jjmpeg-1.0-dev/jjmpeg-android/src/com/edisonwang/android/player )它還包括FFmpeg的重放東西
EDIT 5:它原來是一個可能的高通的Adreno 200系列錯誤:https://developer.qualcomm.com/forum/qdevnet-forums/mobile-gaming-graphics-optimization-adreno/11525
DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x40c30460 self=0x129c0
| sysTid=21854 nice=0 sched=0/0 cgrp=default handle=1074746664
| schedstat=(434522015 268952863 603) utm=34 stm=9 core=0
at android.view.GLES20Canvas.nUpdateTextureLayer(Native Method)
at android.view.GLES20TextureLayer.update(GLES20TextureLayer.java:77)
at android.view.TextureView.applyUpdate(TextureView.java:388)
at android.view.TextureView.draw(TextureView.java:276)
at android.view.View.getDisplayList(View.java:10586)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10549)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10549)
at android.view.ViewGroup.drawChild(ViewGroup.java:2850)
at android.widget.ListView.drawChild(ListView.java:3225)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2489)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2271)
at android.widget.ListView.dispatchDraw(ListView.java:3220)
at android.view.View.draw(View.java:11150)
at android.widget.AbsListView.draw(AbsListView.java:3728)
at android.view.View.getDisplayList(View.java:10586)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10549)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10549)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2597)
at android.view.View.getDisplayList(View.java:10549)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:842)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2011)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1735)
at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2547)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
at dalvik.system.NativeStart.main(Native Method)
"AsyncTask #2" prio=5 tid=19 WAIT
| group="main" sCount=1 dsCount=0 obj=0x415cdf00 self=0x3aa178
| sysTid=8059 nice=10 sched=0/0 cgrp=bg_non_interactive handle=4722816
| schedstat=(369083 125724959 3) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x415ce020> (a java.lang.VMThread) held by tid=19 (AsyncTask #2)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"AsyncTask #1" prio=5 tid=13 WAIT
| group="main" sCount=1 dsCount=0 obj=0x415ca7d8 self=0x30c370
| sysTid=8050 nice=10 sched=0/0 cgrp=bg_non_interactive handle=3105360
| schedstat=(448085 5989790 7) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x415ca970> (a java.lang.VMThread) held by tid=13 (AsyncTask #1)
at java.lang.Thread.parkFor(Thread.java:1231)
at sun.misc.Unsafe.park(Unsafe.java:323)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2022)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:413)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1009)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1069)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
"GLThread 320" prio=5 tid=12 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41535368 self=0x2f7308
| sysTid=8049 nice=0 sched=0/0 cgrp=default handle=2690528
| schedstat=(1744387397 1741438396 2048) utm=169 stm=5 core=1
at com.google.android.gles_jni.EGLImpl.eglSwapBuffers(Native Method)
ndroid.player.GLTextureView$GLThread.run(GLTextureView.java:1261)
"Binder Thread #2" prio=5 tid=10 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x4150bfd8 self=0x217e08
| sysTid=8038 nice=0 sched=0/0 cgrp=default handle=2155984
| schedstat=(1496167 16950375 10) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"Binder Thread #1" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x414fb130 self=0x1bd740
| sysTid=8037 nice=0 sched=0/0 cgrp=default handle=1595520
| schedstat=(2633041 25123960 10) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"FinalizerWatchdogDaemon" daemon prio=5 tid=8 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x414f7490 self=0x182a50
| sysTid=8036 nice=0 sched=0/0 cgrp=default handle=1433120
| schedstat=(288708 6619500 5) utm=0 stm=0 core=0
at java.lang.VMThread.sleep(Native Method)
at java.lang.Thread.sleep(Thread.java:1031)
at java.lang.Thread.sleep(Thread.java:1013)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213)
at java.lang.Thread.run(Thread.java:856)
"FinalizerDaemon" daemon prio=5 tid=7 WAIT
| group="main" sCount=1 dsCount=0 obj=0x414f7338 self=0x105230
| sysTid=8035 nice=0 sched=0/0 cgrp=default handle=1662112
| schedstat=(3763081 5489124 25) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x40c265d0> (a java.lang.ref.ReferenceQueue)
at java.lang.Object.wait(Object.java:401)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168)
at java.lang.Thread.run(Thread.java:856)
"ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT
| group="main" sCount=1 dsCount=0 obj=0x414f71d0 self=0xfa1f0
| sysTid=8034 nice=0 sched=0/0 cgrp=default handle=1662016
| schedstat=(1831625 1206249 33) utm=0 stm=0 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x40c264f8>
at java.lang.Object.wait(Object.java:364)
at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:128)
at java.lang.Thread.run(Thread.java:856)
"Compiler" daemon prio=5 tid=5 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x414f70e0 self=0x1b8688
| sysTid=8033 nice=0 sched=0/0 cgrp=default handle=747976
| schedstat=(182108462 246633083 1197) utm=11 stm=7 core=1
at dalvik.system.NativeStart.run(Native Method)
"JDWP" daemon prio=5 tid=4 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x414f6ff8 self=0x206680
| sysTid=8032 nice=0 sched=0/0 cgrp=default handle=1450968
| schedstat=(1964583 1505832 16) utm=0 stm=0 core=1
at dalvik.system.NativeStart.run(Native Method)
"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
| group="system" sCount=0 dsCount=0 obj=0x414f6f00 self=0x1b7dd8
| sysTid=8031 nice=0 sched=0/0 cgrp=default handle=1660128
| schedstat=(4634792 2711334 6) utm=0 stm=0 core=0
at dalvik.system.NativeStart.run(Native Method)
"GC" daemon prio=5 tid=2 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x414f6e20 self=0x20adb8
| sysTid=8028 nice=0 sched=0/0 cgrp=default handle=1365944
| schedstat=(132084797 114875290 96) utm=10 stm=2 core=1
at dalvik.system.NativeStart.run(Native Method)
有關如何調試這個或爲什麼會發生的任何想法?
我認爲,沒有代碼,我們無法幫到你。 –
謝謝Marek,我添加了代碼來重現它。 – Edison