소스 검색

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];