浏览代码

Fix VLCMediaPlayer dealloc

if the stream hasn't been stopped by the time dealloc is called, stopping it is useless because dealloc will most likely occur on the main thread, and the [stop] method executes asynchronously on a background thread. This is a hopeless situation.

if a stream has completely failed to start (i.e. forbidden RTSP access), the player's state is libvlc_NothingSpecial. Handle this case in the debug assert.

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Florent Pillet 11 年之前
父节点
当前提交
c004a3e98d
共有 1 个文件被更改,包括 1 次插入4 次删除
  1. 1 4
      Sources/VLCMediaPlayer.m

+ 1 - 4
Sources/VLCMediaPlayer.m

@@ -221,10 +221,7 @@ static void HandleMediaPlayerMediaChanged(const libvlc_event_t * event, void * s
 
 - (void)dealloc
 {
-    if (libvlc_media_player_get_state(_playerInstance) != libvlc_Stopped)
-        [self stop];
-
-    NSAssert(libvlc_media_player_get_state(_playerInstance) == libvlc_Stopped, @"You released the media player before ensuring that it is stopped");
+    NSAssert(libvlc_media_player_get_state(_playerInstance) == libvlc_Stopped || libvlc_media_player_get_state(_playerInstance) == libvlc_NothingSpecial, @"You released the media player before ensuring that it is stopped");
 
     [self unregisterObservers];
     [[VLCEventManager sharedManager] cancelCallToObject:self];