Well, I implemented a native video display. It uses DirectDraw and Overlay Surface. It works fine with one or two stream but when I display 3 or 4 then it runs to deadlock. I made a thread stack dump:
“AWT-EventQueue-1” prio=6 tid=0x02ec5ce8 nid=0x904 waiting on condition [0x0354f
000…0x0354fce8]
at sun.java2d.loops.Blit.Blit(Native Method)
at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)
at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at sun.java2d.SunGraphics2D.drawImage(Unknown Source)
at applet.online_view.ViewPort$ImagePanel.paintComponent(Unknown Source)
- locked <0x1f3393f0> (a applet.online_view.ViewPort$ImagePanel)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
- locked <0x1e8d1dc8> (a java.awt.Component$AWTTreeLock)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
.
.
.
I made a stack dump for this thread with Process Explorer:
ntoskrnl.exe!KiSwapContext+0x2e
ntoskrnl.exe!KiSwapThread+0x46
ntoskrnl.exe!KeWaitForSingleObject+0x1c2
ntoskrnl.exe!KiSuspendThread+0x18
ntoskrnl.exe!KiDeliverApc+0x124
ntoskrnl.exe!KiSwapThread+0x64
ntoskrnl.exe!KeWaitForSingleObject+0x1c2
ntoskrnl.exe!NtWaitForSingleObject+0x9a
ntoskrnl.exe!KiFastCallEntry+0xf8
ntdll.dll!KiFastSystemCallRet
ntdll.dll!ZwWaitForSingleObject+0xc
kernel32.dll!WaitForSingleObjectEx+0xa8
kernel32.dll!WaitForSingleObject+0x12
jvm.dll!jmm_GetLastGCStat+0x6964
jvm.dll!AsyncGetCallTrace+0x3f41
jvm.dll!AsyncGetCallTrace+0x26cd3
jvm.dll!AsyncGetCallTrace+0x26c42
awt.dll!Java_sun_awt_image_BufImgSurfaceData_initRaster+0x1a8
My native thread stack:
ntoskrnl.exe!KiSwapContext+0x2e
ntoskrnl.exe!KiSwapThread+0x46
ntoskrnl.exe!KeWaitForSingleObject+0x1c2
ntoskrnl.exe!KiSuspendThread+0x18
ntoskrnl.exe!KiDeliverApc+0x124
ntoskrnl.exe!KiSwapThread+0x64
ntoskrnl.exe!KeWaitForSingleObject+0x1c2
ntoskrnl.exe!NtWaitForSingleObject+0x9a
ntoskrnl.exe!KiFastCallEntry+0xf8
ntdll.dll!KiFastSystemCallRet
ntdll.dll!ZwWaitForSingleObject+0xc
ntdll.dll!RtlpWaitForCriticalSection+0x132
ntdll.dll!RtlEnterCriticalSection+0x46
ddraw.dll!DD_Surface_Lock+0x18
MPEGDecoder.dll!Java_applet_utils_MPEGDecoderIPP_stopBuffering+0x2501
MPEGDecoder.dll+0x5690
So it looks like somehow they stop each other. I only use an overlay surface from the native code and paint on that. I don’t use any other surfaces. When I want to paint on the overlay surface I lock it(to get the video memory pointer) and unlock it after the drawing. Do anybody can help me with this?
Thanks in advance,
Bendeguy