[vlc-devel] commit: media_list_player: Strictier lock in libvlc_media_list_player_play* (). (Pierre d'Herbemont )

git version control git at videolan.org
Tue Aug 25 00:09:09 CEST 2009


vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Mon Aug 24 23:35:58 2009 +0200| [b961e4127bca882c667b116af360ccd64361553c] | committer: Pierre d'Herbemont 

media_list_player: Strictier lock in libvlc_media_list_player_play*().

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b961e4127bca882c667b116af360ccd64361553c
---

 src/control/media_list_player.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/control/media_list_player.c b/src/control/media_list_player.c
index 0f04888..fffa316 100644
--- a/src/control/media_list_player.c
+++ b/src/control/media_list_player.c
@@ -505,14 +505,13 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
 
     lock(p_mlp);
     set_current_playing_item(p_mlp, libvlc_media_list_path_with_root_index(i_index));
+    libvlc_media_player_play(p_mlp->p_mi, p_e);
     unlock(p_mlp);
 
     /* Send the next item event */
     libvlc_event_t event;
     event.type = libvlc_MediaListPlayerNextItemSet;
     libvlc_event_send(p_mlp->p_event_manager, &event);
-
-    libvlc_media_player_play(p_mlp->p_mi, p_e);
 }
 
 /**************************************************************************
@@ -520,18 +519,18 @@ void libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_
  **************************************************************************/
 void libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp, libvlc_media_t * p_md, libvlc_exception_t * p_e)
 {
+    lock(p_mlp);
     libvlc_media_list_path_t path = libvlc_media_list_path_of_item(p_mlp->p_mlist, p_md);
     if (!path)
     {
         libvlc_exception_raise(p_e, "No such item in media list");
+        unlock(p_mlp);
         return;
     }
     
-    lock(p_mlp);
-    set_current_playing_item(p_mlp, path);
-    unlock(p_mlp);
-    
+    set_current_playing_item(p_mlp, path);    
     libvlc_media_player_play(p_mlp->p_mi, p_e);
+    unlock(p_mlp);
 }
 
 /**************************************************************************




More information about the vlc-devel mailing list