[vlc-devel] [PATCH] 64-bit support for mozilla plugin on Mac OS X

Pierre d'Herbemont pdherbemont at gmail.com
Tue May 11 01:02:52 CEST 2010

On May 11, 2010, at 12:32 AM, David Menestrina wrote:

> This patchset (against the 1.1 fork) fixes the VLC mozilla plugin to work
> in 64 bit browsers on Mac OS X (currently the only such browser is Safari).
> 64-bit browser plugins can no longer use the old Carbon based QuickDraw APIs.
> Instead, they must implement either the Core Graphics or Core Animation drawing
> models.  Further, they must implement the Cocoa event model.  Here, we create a
> new vout display module that writes to a Core Animation layer, and then we use this
> vout display to implement the Core Animation drawing model.
> I am quite new to both VLC and Mac OS X development, so there are bound to be bugs,
> and there are even a few known issues that I just don't have the expertise to figure
> out at this time.  I would greatly appreciate the assistance of some real Mac OS
> developers to look over the code.  Known issues:
>  1) Cocoa documentation says that NSView is not threadsafe, yet this
>     code uses NSView in the vout thread for entering fullscreen mode.

It's easy to dispatch a selector on main thread using -performSelectorOnMainThread:withObject:, why don't you use it?

>  2) Perhaps due to some release/retain issues, or perhaps some race
>     conditions, the plugin crashes when closing the page using it.  The
>     stack trace for the crash is unfortunately in Safari code, which
>     makes it difficult to debug.

Generally using AppKit from non main thread is a bad idea. The CoreAnimation code being used is heavily relying on AppKit's own CA backend. So I wouldn't assume bet too much on CoreAnimation also.

>  3) I have read that Cocoa requires an NSAutoreleasePool to exist for
>     any thread that makes Cocoa calls.  The vout thread does not have one,
>     and therefore the plugin will leak memory.
It's easy to create one when one is needed. Just wrap your Code like this:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Code
[pool drain];



More information about the vlc-devel mailing list