Commit 3863d8b0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

No need to lock the playlist for meta fetch and preparsing

The previous fix made the fetcher and preparser persistent throughout
the lifetime of the playlist. So we don't need to protect the pointers
anymore. Also, they are internally thread-safe (with their own lock).
parent 14ee5f12
...@@ -300,10 +300,10 @@ VLC_EXPORT( input_thread_t *, playlist_CurrentInput, ( playlist_t *p_playlist ) ...@@ -300,10 +300,10 @@ VLC_EXPORT( input_thread_t *, playlist_CurrentInput, ( playlist_t *p_playlist )
VLC_EXPORT( void, playlist_Clear, ( playlist_t *, bool ) ); VLC_EXPORT( void, playlist_Clear, ( playlist_t *, bool ) );
/** Enqueue an input item for preparsing */ /** Enqueue an input item for preparsing */
VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t *, bool b_locked ) ); VLC_EXPORT( int, playlist_PreparseEnqueue, (playlist_t *, input_item_t * ) );
/** Request the art for an input item to be fetched */ /** Request the art for an input item to be fetched */
VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t *, bool b_locked ) ); VLC_EXPORT( int, playlist_AskForArtEnqueue, (playlist_t *, input_item_t * ) );
/* Playlist sorting */ /* Playlist sorting */
VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) ); VLC_EXPORT( int, playlist_TreeMove, ( playlist_t *, playlist_item_t *, playlist_item_t *, int ) );
......
...@@ -959,7 +959,7 @@ ...@@ -959,7 +959,7 @@
{ {
if( p_item->i_children == -1 ) if( p_item->i_children == -1 )
{ {
playlist_PreparseEnqueue( p_playlist, p_item->p_input, pl_Unlocked ); playlist_PreparseEnqueue( p_playlist, p_item->p_input );
} }
else else
{ {
...@@ -995,7 +995,7 @@ ...@@ -995,7 +995,7 @@
if( p_item && p_item->i_children == -1 ) if( p_item && p_item->i_children == -1 )
{ {
playlist_AskForArtEnqueue( p_playlist, p_item->p_input, pl_Unlocked ); playlist_AskForArtEnqueue( p_playlist, p_item->p_input );
} }
} }
pl_Release( p_intf ); pl_Release( p_intf );
......
...@@ -253,7 +253,7 @@ static VLCInfo *_o_sharedInstance = nil; ...@@ -253,7 +253,7 @@ static VLCInfo *_o_sharedInstance = nil;
if( !input_item_IsPreparsed( p_item ) ) if( !input_item_IsPreparsed( p_item ) )
{ {
playlist_t * p_playlist = pl_Hold( VLCIntf ); playlist_t * p_playlist = pl_Hold( VLCIntf );
playlist_PreparseEnqueue( p_playlist, p_item, pl_Unlocked ); playlist_PreparseEnqueue( p_playlist, p_item );
pl_Release( VLCIntf ); pl_Release( VLCIntf );
} }
...@@ -404,7 +404,7 @@ error: ...@@ -404,7 +404,7 @@ error:
- (IBAction)downloadCoverArt:(id)sender - (IBAction)downloadCoverArt:(id)sender
{ {
playlist_t * p_playlist = pl_Hold( VLCIntf ); playlist_t * p_playlist = pl_Hold( VLCIntf );
if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item, pl_Unlocked ); if( p_item) playlist_AskForArtEnqueue( p_playlist, p_item );
pl_Release( VLCIntf ); pl_Release( VLCIntf );
} }
......
...@@ -595,7 +595,7 @@ void InputManager::requestArtUpdate() ...@@ -595,7 +595,7 @@ void InputManager::requestArtUpdate()
if( hasInput() ) if( hasInput() )
{ {
playlist_t *p_playlist = pl_Hold( p_intf ); playlist_t *p_playlist = pl_Hold( p_intf );
playlist_AskForArtEnqueue( p_playlist, input_GetItem( p_input ), pl_Unlocked ); playlist_AskForArtEnqueue( p_playlist, input_GetItem( p_input ) );
pl_Release( p_intf ); pl_Release( p_intf );
} }
else else
......
...@@ -228,7 +228,7 @@ static void preparse_if_needed( libvlc_media_t *p_md ) ...@@ -228,7 +228,7 @@ static void preparse_if_needed( libvlc_media_t *p_md )
{ {
playlist_PreparseEnqueue( playlist_PreparseEnqueue(
libvlc_priv (p_md->p_libvlc_instance->p_libvlc_int)->p_playlist, libvlc_priv (p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item, pl_Unlocked ); p_md->p_input_item );
p_md->b_preparsed = true; p_md->b_preparsed = true;
} }
} }
...@@ -447,7 +447,7 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta ) ...@@ -447,7 +447,7 @@ char *libvlc_media_get_meta( libvlc_media_t *p_md, libvlc_meta_t e_meta )
p_md->has_asked_art = true; p_md->has_asked_art = true;
playlist_AskForArtEnqueue( playlist_AskForArtEnqueue(
libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist, libvlc_priv(p_md->p_libvlc_instance->p_libvlc_int)->p_playlist,
p_md->p_input_item, pl_Unlocked ); p_md->p_input_item );
} }
/* Should be integrated in core */ /* Should be integrated in core */
......
...@@ -216,28 +216,22 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args ...@@ -216,28 +216,22 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
* Preparse control * Preparse control
*****************************************************************************/ *****************************************************************************/
/** Enqueue an item for preparsing */ /** Enqueue an item for preparsing */
int playlist_PreparseEnqueue( playlist_t *p_playlist, int playlist_PreparseEnqueue( playlist_t *p_playlist, input_item_t *p_item )
input_item_t *p_item, bool b_locked )
{ {
playlist_private_t *p_sys = pl_priv(p_playlist); playlist_private_t *p_sys = pl_priv(p_playlist);
PL_LOCK_IF( !b_locked );
if( p_sys->p_preparser ) if( p_sys->p_preparser )
playlist_preparser_Push( p_sys->p_preparser, p_item ); playlist_preparser_Push( p_sys->p_preparser, p_item );
PL_UNLOCK_IF( !b_locked );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
int playlist_AskForArtEnqueue( playlist_t *p_playlist, int playlist_AskForArtEnqueue( playlist_t *p_playlist, input_item_t *p_item )
input_item_t *p_item, bool b_locked )
{ {
playlist_private_t *p_sys = pl_priv(p_playlist); playlist_private_t *p_sys = pl_priv(p_playlist);
PL_LOCK_IF( !b_locked );
if( p_sys->p_fetcher ) if( p_sys->p_fetcher )
playlist_fetcher_Push( p_sys->p_fetcher, p_item ); playlist_fetcher_Push( p_sys->p_fetcher, p_item );
PL_UNLOCK_IF( !b_locked );
return VLC_SUCCESS; return VLC_SUCCESS;
} }
......
...@@ -726,7 +726,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode, ...@@ -726,7 +726,7 @@ static void GoAndPreparse( playlist_t *p_playlist, int i_mode,
input_item_IsPreparsed( p_item->p_input ) == false && input_item_IsPreparsed( p_item->p_input ) == false &&
( EMPTY_STR( psz_artist ) || ( EMPTY_STR( psz_album ) ) ) ( EMPTY_STR( psz_artist ) || ( EMPTY_STR( psz_album ) ) )
) )
playlist_PreparseEnqueue( p_playlist, p_item->p_input, pl_Locked ); playlist_PreparseEnqueue( p_playlist, p_item->p_input );
free( psz_artist ); free( psz_artist );
free( psz_album ); free( psz_album );
} }
......
...@@ -271,7 +271,7 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item ) ...@@ -271,7 +271,7 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) ) if( !b_has_art || strncmp( psz_arturl, "attachment://", 13 ) )
{ {
PL_DEBUG( "requesting art for %s", psz_name ); PL_DEBUG( "requesting art for %s", psz_name );
playlist_AskForArtEnqueue( p_playlist, p_input, pl_Locked ); playlist_AskForArtEnqueue( p_playlist, p_input );
} }
free( psz_arturl ); free( psz_arturl );
free( psz_name ); free( psz_name );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment