瀏覽代碼

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);
 }