Commit d591dcc0 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

MacOSX/Framework/VLCMediaPlayer.m: Avoid some Mac OS X libvlc-specific deadlocks.

parent 7d06af29
......@@ -437,6 +437,16 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
- (void)pause
{
if( [NSThread isMainThread] )
{
/* Hack because we create a dead lock here, when the vout is stopped
* and tries to recontact us on the main thread */
/* FIXME: to do this properly we need to do some locking. We may want
* to move that to libvlc */
[self performSelectorInBackground:@selector(pause) withObject:nil];
return;
}
// Return if there is no media available or if the stream is not paused or
// playing something else
if (!media || (![self isPlaying] && [self state] != VLCMediaPlayerStatePaused))
......@@ -446,6 +456,7 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
if (!instance)
return;
// Pause the stream
libvlc_exception_t ex;
libvlc_exception_init( &ex );
......@@ -458,6 +469,16 @@ static void HandleMediaInstanceStateChanged(const libvlc_event_t * event, void *
- (void)stop
{
if( [NSThread isMainThread] )
{
/* Hack because we create a dead lock here, when the vout is stopped
* and tries to recontact us on the main thread */
/* FIXME: to do this properly we need to do some locking. We may want
* to move that to libvlc */
[self performSelectorInBackground:@selector(pause) withObject:nil];
return;
}
// Return if there is no media available or if the system is not in play status
// or pause status.
if (!media || (![self isPlaying] && [self state] != VLCMediaPlayerStatePaused))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment