QB crash with movie loader externaltimebase

itsthejayj's picture

Hi guys. Quartz Builder is my favorite application developed by the kineme lads and i cannot recommend it enough for QC'ers who don't want to get there hands dirty in xcode,

However i'm currently having a nightmare with the movie loader patch (quicktime) crashing my application. I starting to think its the same quicktime bug noted by chris (http://kineme.net/Release/Production/QuartzBuilderandinteraction) Everything is stable in QC but it seems whenever the movieloader's patchtime is controlled in QB i get a crash. In fact i appears the crash only happens when the user clicks and on the GUI.

I'm hoping someone can help me out here. I've attached a couple of example QB files original compositions, crash reports and video of my problem. Thanks

J

PreviewAttachmentSize
QBcrash.zip10.89 MB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: QB crash with movie loader externaltimebase

Try the v002 player if your using Quartz Builder (or probably anything).

I haven't tested it lately (the v002), but I'm 100% certain that the regular movie player flakes out for the exact reasons the cwright noted. I'm surprised you have it work at all when in parent time mode (or any time mode). I've never had it crash QB, but it will flake on delivering an image.

vade's picture
Re: QB crash with movie loader externaltimebase

To be fair, the QC movie player actually is thread safe. I spent an afternoon with _lov discussing it and while I thought running a QC comp in a background thread would be an issue, it is not. it works, so it should here.

I dont know the specifics of Quartz Builders internal code, but in order to not get issues and have the movie player work, the QC Renderer has to be initted and run only in, and from the rendering thread. You will get issues if you create it in one thread, and attempt to run it in another.

Maybe there is a reason that has to happen in QC Builder, but as of 10.6, in 32 or 64 bit mode it ought to work, I've tested both.

cwright's picture
Re: QB crash with movie loader externaltimebase

vade wrote:
To be fair, the QC movie player actually is thread safe. ... but in order to not get issues and have the movie player work, the QC Renderer has to be initted and run only in, and from the rendering thread. You will get issues if you create it in one thread, and attempt to run it in another.

If you created a CGLContextObj on the main thread, and used it in a display link, and it failed, you would 1) file a radar, and 2) not even joke about it being thread-safe. Why does QC get preferential treatment?

(I bring that up because I can pretty much guarantee that no one sets up a CGLContextObj in a CVDisplayLink handler, because that's just weird)

vade's picture
Re: QB crash with movie loader externaltimebase

Wait, what?

Maybe I'm confused, but this is what I had to do to get QCPlayerPlus (the little weirdo SF app Toby and I made based on QC Player) to work with a QCRenderer playing in a CVDisplayLink, with a movie.

1) Make a CGLContext/PixelFormat combo via NSOpenGLContex/friends 2) Make a display link 3) Fire display link 4) Check on the display link if our QCRenderer was there, if not, make it on the display link.

We were not doing #4, and making the QCRenderer on the main thread the calling it from the display link, which is why it was bailing the movie player for us, that also is mentioned in the tech note about leaking QCRenderers no?

Edit, I suppose you mean safe to move between threads, which near as I can tell the QC movie player is not. If thats what you meant, then we are in agreement!

itsthejayj's picture
Re: QB crash with movie loader externaltimebase

Right ok, well at least i'm not doing anything too wrong here, thanks. Vades movie loader is stable in QB but i'm having to use the movie loader in conjunction with v002 movie loader due to the initial launching hang and the more precise looping/scrubbing of multiple movies.

looks like i'm a bit stuck then ;(

vade's picture
Re: QB crash with movie loader externaltimebase

What issues do you have with the v002 movie player? Are you using the latest beta?

cwright's picture
Re: QB crash with movie loader externaltimebase

I'm assuming you mean this: http://developer.apple.com/mac/library/qa/qa2008/qa1538.html ?

If so, I stand by my word: why is this not considered a bug, and why is this considered "thread safe"? It's clearly stating that QCRenderer is not thread safe (some content won't work, it will leak memory), if thread safe = use totally atomically between different threads (your "move" part). Further, it's a bug that prevents intuitive operation of stuff (setup/alloc in displaylink callback is an abomination -- it happens to work, so people do it, but that doesn't make it a good design).

What other objects are there that leak memory when you alloc on one thread, and use on another (in a safe, locked manner)?

(note: this probably uncovered how to make QuartzBuilder work, at the cost of an additional branch + a few L1 misses per frame -- put the initialization stuff in the callback... what a hack)

vade's picture
Re: QB crash with movie loader externaltimebase

Ah, I guess I had my terminology confused then, apologies. I misconstrued thread safe = running in another thread, not necessarily running, plus moving around to other threads. Disregard me!

itsthejayj's picture
Re: QB crash with movie loader externaltimebase

Mainly it's the performance when scrubbing the playhead continuously in a loop, compared to using external timebase control in qcs movie loader. The plugin I'm using is dated Aug 19 2009.

vade's picture
Re: QB crash with movie loader externaltimebase

Are you making sure to stop the movie when you scrub?

itsthejayj's picture
Re: QB crash with movie loader externaltimebase

Arh brilliant what an painfull oversight, thats the fix, I havnt been stopping the clip. Thanks, I feel foolish now.

vade's picture
Re: QB crash with movie loader externaltimebase

Yea, its one of the catches to running in Ansync 'mode' all the time, its not linked to the time base at all, so its perpetually playing unless you stop it, or stop the rendering completely.

cybero's picture
Re: QB crash with movie loader externaltimebase

I was getting all sorts of GF Log errors when starting the Q B app, switching between movies and so on, all of which have gone - including the usual thread messages referred to above, once I employed Vade's Movie Player patch.

Made a little movie switcher for QB using a keyboard equivalent of the multi touch swipe controller posted elsewhere by gtoledo3.

I had begun to think that QB was also having a problem with text [Image with String or Instructions], but this turned out to be a product of the difference in how QB defaults vis a vis backgrounds.

PreviewAttachmentSize
ImageWithStringAndMovie.qtz10.24 KB

gtoledo3's picture
Re: QB crash with movie loader externaltimebase

Can QB just get upgraded to do this? The sample Xcode projects work fine with Movie Loader, so it's pretty unexpected to have to even think about this... especially since it seems like playing movies and QC kinda go together. (I don't think there were warning about this not working originally, or maybe still?).