Procházet zdrojové kódy

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 před 11 roky
rodič
revize
c004a3e98d
1 změnil soubory, kde provedl 1 přidání a 4 odebrání
  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];