瀏覽代碼

player: protect play against calls from the main thread

(cherry picked from commit abe8875413c8c8d72f585ce5af4d334d35b93af0)
Felix Paul Kühne 9 年之前
父節點
當前提交
180b6287a4
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      Sources/VLCMediaPlayer.m

+ 9 - 0
Sources/VLCMediaPlayer.m

@@ -1055,6 +1055,15 @@ static void HandleMediaPlayerSnapshot(const libvlc_event_t * event, void * self)
 
 
 - (void)play
 - (void)play
 {
 {
+    if ([NSThread isMainThread]) {
+        /* Hack because we create a dead lock here, when the vout is created
+         * 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(play) withObject:nil];
+        return;
+    }
+
     libvlc_media_player_play(_playerInstance);
     libvlc_media_player_play(_playerInstance);
 }
 }