From: Gildas Bazin Date: Thu, 21 Nov 2002 15:51:57 +0000 (+0000) Subject: * src/playlist/playlist.c: fixed deadlock in playlist. X-Git-Tag: 0.5.0~682 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8e3e302dffe73b199cbfbb5faf6ce95cc0247a3f;p=vlc * src/playlist/playlist.c: fixed deadlock in playlist. * modules/audio_output/oss.c: don't play blank samples when we are starving for data but our internal buffers are not empty. Some cleanup too. --- diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c index c718cd4a0c..1de455c771 100644 --- a/modules/audio_output/oss.c +++ b/modules/audio_output/oss.c @@ -2,7 +2,7 @@ * oss.c : OSS /dev/dsp module for vlc ***************************************************************************** * Copyright (C) 2000-2002 VideoLAN - * $Id: oss.c,v 1.33 2002/11/14 22:38:47 massiot Exp $ + * $Id: oss.c,v 1.34 2002/11/21 15:51:57 gbazin Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -420,7 +420,7 @@ static int Open( vlc_object_t *p_this ) free( p_sys ); return VLC_EGENERIC; } - else + else { /* Number of fragments actually allocated */ p_aout->output.p_sys->i_fragstotal = audio_buf.fragstotal; @@ -540,21 +540,21 @@ static int OSSThread( aout_instance_t * p_aout ) #undef i_fragstotal } - if( !next_date ) - { - /* This is the _real_ presentation date */ - next_date = mdate() + buffered; - } - else + /* Next buffer will be played at mdate() + buffered */ + p_buffer = aout_OutputNextBuffer( p_aout, mdate() + buffered, + VLC_FALSE ); + + if( p_buffer == NULL && + buffered > ( p_aout->output.p_sys->max_buffer_duration + / p_aout->output.p_sys->i_fragstotal ) ) { - /* Give a hint to the audio output about our drift, but - * not too much because we want to make it happy with our - * nicely calculated dates. */ - next_date = ( (next_date * 7) + (mdate() + buffered) ) / 8; + /* If we have at least a fragment full, then we can wait a + * little and retry to get a new audio buffer instead of + * playing a blank sample */ + msleep( ( p_aout->output.p_sys->max_buffer_duration + / p_aout->output.p_sys->i_fragstotal / 2 ) ); + continue; } - - /* Next buffer will be played at mdate()+buffered */ - p_buffer = aout_OutputNextBuffer( p_aout, next_date, VLC_FALSE ); } else { diff --git a/src/playlist/playlist.c b/src/playlist/playlist.c index ee3196c5fc..e5c15c1118 100644 --- a/src/playlist/playlist.c +++ b/src/playlist/playlist.c @@ -2,7 +2,7 @@ * playlist.c : Playlist management functions ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: playlist.c,v 1.22 2002/11/18 13:08:35 gbazin Exp $ + * $Id: playlist.c,v 1.23 2002/11/21 15:51:57 gbazin Exp $ * * Authors: Samuel Hocevar * @@ -322,7 +322,9 @@ static void RunThread ( playlist_t *p_playlist ) /* Check for autodeletion */ if( p_playlist->pp_items[p_playlist->i_index]->b_autodeletion ) { + vlc_mutex_unlock( &p_playlist->object_lock ); playlist_Delete( p_playlist, p_playlist->i_index ); + vlc_mutex_lock( &p_playlist->object_lock ); } /* Select the next playlist item */