Commit a7e097b4 authored by Stéphane Borel's avatar Stéphane Borel

*check for b_die and b_error in all loops so that we don't remain stuck

waiting for data whereas the vlc has tried to quit.
parent 3425b2e6
......@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.23 2002/04/23 14:16:20 sam Exp $
* $Id: ac3_spdif.c,v 1.24 2002/05/17 18:01:25 stef Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -223,9 +223,13 @@ static int decoder_Run( decoder_config_t * p_config )
* Therefore a non-zero value after a call to GetBits() means the PES
* has changed. */
b_sync = 0;
while( !b_sync )
while( !p_spdif->p_fifo->b_die
&& !p_spdif->p_fifo->b_error
&& !b_sync )
{
while( GetBits( &p_spdif->bit_stream, 8 ) != 0x0b );
while( !p_spdif->p_fifo->b_die
&& !p_spdif->p_fifo->b_error
&& GetBits( &p_spdif->bit_stream, 8 ) != 0x0b );
p_spdif->i_real_pts = p_spdif->i_pts;
p_spdif->i_pts = 0;
b_sync = ( ShowBits( &p_spdif->bit_stream, 8 ) == 0x77 );
......@@ -273,13 +277,23 @@ static int InitThread( ac3_spdif_thread_t * p_spdif )
BitstreamCallback, (void*)p_spdif );
/* Find syncword */
while( !b_sync )
while( !p_spdif->p_fifo->b_die
&& !p_spdif->p_fifo->b_error
&& !b_sync )
{
while( GetBits( &p_spdif->bit_stream, 8 ) != 0x0b );
while( !p_spdif->p_fifo->b_die
&& !p_spdif->p_fifo->b_error
&& GetBits( &p_spdif->bit_stream, 8 ) != 0x0b );
p_spdif->i_real_pts = p_spdif->i_pts;
p_spdif->i_pts = 0;
b_sync = ( ShowBits( &p_spdif->bit_stream, 8 ) == 0x77 );
}
if( p_spdif->p_fifo->b_die || p_spdif->p_fifo->b_error )
{
return -1;
}
RemoveBits( &p_spdif->bit_stream, 8 );
/* Check stream properties */
......@@ -362,8 +376,8 @@ static void EndThread( ac3_spdif_thread_t * p_spdif )
*****************************************************************************
* This function is called by input's NextDataPacket.
*****************************************************************************/
static void BitstreamCallback ( bit_stream_t * p_bit_stream,
boolean_t b_new_pes)
static void BitstreamCallback( bit_stream_t * p_bit_stream,
boolean_t b_new_pes )
{
ac3_spdif_thread_t * p_spdif;
......
......@@ -2,7 +2,7 @@
* aout_spdif.c: AC3 passthrough output
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: aout_spdif.c,v 1.26 2002/03/15 01:47:16 stef Exp $
* $Id: aout_spdif.c,v 1.27 2002/05/17 18:01:25 stef Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -93,17 +93,20 @@ void aout_SpdifThread( aout_thread_t * p_aout )
int i_fifo;
mtime_t m_frame_time = 0;
mtime_t m_play;
mtime_t m_old;
while( !p_aout->b_die )
{
i_fifo = 0;
/* Find spdif fifo */
while( ( p_aout->fifo[i_fifo].i_format != AOUT_FIFO_SPDIF ) &&
( i_fifo < AOUT_MAX_FIFOS ) )
( i_fifo < AOUT_MAX_FIFOS ) && !p_aout->b_die )
{
i_fifo++;
}
m_old = 0;
while( !p_aout->b_die &&
!p_aout->fifo[i_fifo].b_die )
{
......@@ -133,7 +136,6 @@ void aout_SpdifThread( aout_thread_t * p_aout )
* dsp buffer is empty enough to accept the data */
if( m_play > ( mdate() - m_frame_time ) )
{
#if 0
/* check continuity */
if( (m_play - m_old) != m_frame_time )
{
......@@ -144,9 +146,7 @@ void aout_SpdifThread( aout_thread_t * p_aout )
mwait( m_play - 2 * m_frame_time );
}
m_old = m_play;
#else
mwait( m_play - m_frame_time );
#endif
p_aout->pf_getbufinfo( p_aout, 0 );
p_aout->pf_play( p_aout, (byte_t *)p_aout->buffer,
......@@ -155,9 +155,16 @@ void aout_SpdifThread( aout_thread_t * p_aout )
}
else
{
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
msleep( m_frame_time );
intf_WarnMsg( 3, "aout warning: empty spdif fifo" );
while( AOUT_FIFO_ISEMPTY( p_aout->fifo[i_fifo] ) &&
!p_aout->b_die &&
!p_aout->fifo[i_fifo].b_die )
{
vlc_mutex_unlock( &p_aout->fifo[i_fifo].data_lock );
msleep( m_frame_time );
vlc_mutex_lock( &p_aout->fifo[i_fifo].data_lock );
}
}
}
......
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