فهرست منبع

VLCMediaPlayer: re-add hack from f7c6bb30 to prevent deadlocks when stopping an input

Felix Paul Kühne 12 سال پیش
والد
کامیت
b1562efd87
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      Sources/VLCMediaPlayer.m

+ 9 - 0
Sources/VLCMediaPlayer.m

@@ -820,6 +820,15 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (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(stop) withObject:nil];
+        return;
+    }
+
     libvlc_media_player_stop(_playerInstance);
 }