|Subject:||Re: rococoa video player|
|From:||Greg Kellum (gkel...@limewire.com)|
|Date:||Dec 18, 2009 1:24:54 pm|
Well, it sounds like I might need to use calls to Thread.join in a few other
places then as well.
On Dec 18, 2009, at 4:04 PM, Duncan McGregor wrote:
I know that I've seen similar deadlocking problems when playing and accepting
drops using a clients QTJ player, or playing while the user selects menu options
that then affect the player. My theory is that there is nasty interaction
between some global lock that is taken and held by QT, and the task movies on
main thread architecture that is a throwback to OS 7
On 18 Dec 2009, at 20:27, Greg Kellum wrote:
I've been working on integrating Rococoa into our application's existing video
player. We have a separate control panel which we use for stopping, starting,
and skipping into video, and we have a timer that runs in the background that
gets the current time from the movie and updates the time on the control panel.
I noticed a strange problem today that happens when resizing the video player.
When this happens, we make the call to get the current media time to the movie.
The call is given over to Cocoa's main thread, and it never comes back. And
since this call was being made on the EDT, it caused our application to hang.
I've made a work around for the problem where I now get the current media time
using a thread which I force to join with the current thread or get killed after
100 milliseconds. So, now as far as the user can tell, everything is working
fine. But I'm still curious as to why getting the media time while the video
player is resizing is causing problems. I wondered whether the Cocoa main
thread might run into a deadlock, but I can't see what's happening on the native
level in my Java profiler.
I've copied the stack trace below showing where the call to get the media time
If anyone has any ideas regarding why this might be happening, I'd appreciate
Name: AWT-EventQueue-0 State: RUNNABLE Total blocked: 1,353 Total waited: 1,172
Stack trace: com.sun.jna.Function.invokeVoid(Native Method) com.sun.jna.Function.invoke(Function.java:283) com.sun.jna.Function.invoke(Function.java:231) com.sun.jna.Library$Handler.invoke(Library.java:216) $Proxy116.callOnMainThread(Unknown Source) org.rococoa.internal.MainThreadUtils.callOnMainThread(MainThreadUtils.java:71) org.rococoa.Foundation.callOnMainThread(Foundation.java:227) org.rococoa.internal.ObjCObjectInvocationHandler.sendOnThisOrMainThread(ObjCObjectInvocationHandler.java:248) org.rococoa.internal.ObjCObjectInvocationHandler.invokeCocoa(ObjCObjectInvocationHandler.java:222) org.rococoa.internal.ObjCObjectInvocationHandler.intercept(ObjCObjectInvocationHandler.java:185) org.rococoa.cocoa.qtkit.QTMovie$$ByRococoa.currentTime(<generated>) net.sf.fmj.qt.media.content.unknown.JavaToCocoaHandler.getMediaTime(JavaToCocoaHandler.java:219) - locked net.sf.fmj.qt.media.content.unknown.JavaToCocoaHandler@34cccc org.limewire.ui.swing.player.VideoPlayerMediator$TimerAction.actionPerformed(VideoPlayerMediator.java:426) javax.swing.Timer.fireActionPerformed(Timer.java:271) javax.swing.Timer$DoPostEvent.run(Timer.java:201) java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209) java.awt.EventQueue.dispatchEvent(EventQueue.java:633) java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) java.awt.EventDispatchThread.run(EventDispatchThread.java:122)