diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-07-06 22:53:22 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2004-07-06 22:53:22 +0000 |
commit | 40aab85f00b16aedeb638bd4ff7693d908ad5d60 (patch) | |
tree | d32ac09a4fe0ec1092ed575dcc38e1572f6c4e42 /src/xine-engine/audio_decoder.c | |
parent | 4bf855750a173f0c002a231cc6307c47719867d1 (diff) | |
download | xine-lib-40aab85f00b16aedeb638bd4ff7693d908ad5d60.tar.gz xine-lib-40aab85f00b16aedeb638bd4ff7693d908ad5d60.tar.bz2 |
fix a long standing bug: streams were not played till their very end, because
finished event was sent to frontend before the output fifos were empty.
add a test for the number of streams attached to the output port. this will
prevent deadlocking on multi-streams scenarios where fifos don't ever get empty.
CVS patchset: 6777
CVS date: 2004/07/06 22:53:22
Diffstat (limited to 'src/xine-engine/audio_decoder.c')
-rw-r--r-- | src/xine-engine/audio_decoder.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c index 1b4c68457..b69908384 100644 --- a/src/xine-engine/audio_decoder.c +++ b/src/xine-engine/audio_decoder.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_decoder.c,v 1.128 2004/04/26 17:50:12 mroi Exp $ + * $Id: audio_decoder.c,v 1.129 2004/07/06 22:53:22 miguelfreitas Exp $ * * * functions that implement audio decoding @@ -119,6 +119,25 @@ static void *audio_decoder_loop (void *stream_gen) { } first_header = last_header = NULL; } + + /* + * wait the output fifos to run dry before sending the notification event + * to the frontend. this test is only valid if there is only a single + * stream attached to the current output port. + */ + while(1) { + int num_bufs, num_streams; + + running_ticket->acquire(running_ticket, 0); + num_bufs = stream->audio_out->get_property(stream->audio_out, AO_PROP_BUFS_IN_FIFO); + num_streams = stream->audio_out->get_property(stream->audio_out, AO_PROP_NUM_STREAMS); + running_ticket->release(running_ticket, 0); + + if( num_bufs > 0 && num_streams == 1 ) + xine_usec_sleep (10000); + else + break; + } /* wait for video to reach this marker, if necessary */ pthread_mutex_lock (&stream->counter_lock); |