[vlc-devel] [vlc-commits] playlist: reduce lock contention and do not pretend to handle error
Thomas Guillem
thomas at gllm.fr
Mon Nov 17 10:25:01 CET 2014
This break vlc-android at startup:
gdb backtrace:
Program received signal SIGABRT, Aborted.
0x400c8f78 in tgkill () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#0 0x400c8f78 in tgkill () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#1 0x400ba010 in pthread_kill () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#2 0x400ba224 in raise () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#3 0x400b8f5a in ?? () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#4 0x400c8830 in abort () from
/home/tom/work/git/vlc-android/vlc-android/obj/local/armeabi-v7a/libc.so
#5 0x754c2250 in playlist_Destroy (p_playlist=0x7668423c) at
../../src/playlist/engine.c:341
#6 0x00000000 in ?? ()
On Sat, Nov 15, 2014, at 11:29, Rémi Denis-Courmont wrote:
> vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 15
> 12:28:40 2014 +0200| [84ec01684530f5bb7a8cb2bc86c8da4dd6c94341] |
> committer: Rémi Denis-Courmont
>
> playlist: reduce lock contention and do not pretend to handle error
>
> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=84ec01684530f5bb7a8cb2bc86c8da4dd6c94341
> ---
>
> src/playlist/engine.c | 45
> +++++++++++++++++----------------------------
> 1 file changed, 17 insertions(+), 28 deletions(-)
>
> diff --git a/src/playlist/engine.c b/src/playlist/engine.c
> index 00bfb61..990bcb1 100644
> --- a/src/playlist/engine.c
> +++ b/src/playlist/engine.c
> @@ -229,38 +229,27 @@ playlist_t *playlist_Create( vlc_object_t *p_parent
> )
>
> pl_priv(p_playlist)->b_tree = var_InheritBool( p_parent,
> "playlist-tree" );
>
> - /* Create the root node */
> - PL_LOCK;
> - p_playlist->p_root = playlist_NodeCreate( p_playlist, NULL, NULL,
> - PLAYLIST_END, 0, NULL );
> - PL_UNLOCK;
> - if( !p_playlist->p_root ) return NULL;
> + /* Create the root, playing items and meida library nodes */
> + playlist_item_t *root, *playing, *ml;
>
> - /* Create currently playing items node */
> PL_LOCK;
> - p_playlist->p_playing = playlist_NodeCreate(
> - p_playlist, _( "Playlist" ), p_playlist->p_root,
> - PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
> -
> + root = playlist_NodeCreate( p_playlist, NULL, NULL,
> + PLAYLIST_END, 0, NULL );
> + playing = playlist_NodeCreate( p_playlist, _( "Playlist" ), root,
> + PLAYLIST_END, PLAYLIST_RO_FLAG, NULL
> );
> + if( var_InheritBool( p_parent, "media-library") )
> + ml = playlist_NodeCreate( p_playlist, _( "Media Library" ),
> root,
> + PLAYLIST_END, PLAYLIST_RO_FLAG, NULL
> );
> + else
> + ml = NULL;
> PL_UNLOCK;
>
> - if( !p_playlist->p_playing ) return NULL;
> -
> - /* Create media library node */
> - const bool b_ml = var_InheritBool( p_parent, "media-library");
> - if( b_ml )
> - {
> - PL_LOCK;
> - p_playlist->p_media_library = playlist_NodeCreate(
> - p_playlist, _( "Media Library" ), p_playlist->p_root,
> - PLAYLIST_END, PLAYLIST_RO_FLAG, NULL );
> - PL_UNLOCK;
> - }
> - else
> - {
> - p_playlist->p_media_library = NULL;
> - }
> + if( unlikely(root == NULL || playing == NULL || ml == NULL) )
> + abort();
>
> + p_playlist->p_root = root;
> + p_playlist->p_playing = playing;
> + p_playlist->p_media_library = ml;
> p_playlist->p_root_category = p_playlist->p_root;
> p_playlist->p_root_onelevel = p_playlist->p_root;
> p_playlist->p_local_category = p_playlist->p_playing;
> @@ -274,7 +263,7 @@ playlist_t *playlist_Create( vlc_object_t *p_parent )
> pl_priv(p_playlist)->request.b_request = false;
> pl_priv(p_playlist)->status.i_status = PLAYLIST_STOPPED;
>
> - if(b_ml)
> + if (ml != NULL)
> playlist_MLLoad( p_playlist );
>
> /* Preparser (and meta retriever) _after_ the Media Library*/
>
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits
More information about the vlc-devel
mailing list