Commit 830af7ae authored by Gildas Bazin's avatar Gildas Bazin

* ./include/inpu_ext-dec.h added a check to fifo->b_die after the call
to BitstreamNextDataPacket() in GetChunk().
Code using GetChunk() also needs to check fifo->b_die before using the
obtained data.
This fixes frequent crashes you get on win32 with the a52 plugin when you
close a stream.
parent f8a2f7c8
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_ext-dec.h: structures exported to the VideoLAN decoders * input_ext-dec.h: structures exported to the VideoLAN decoders
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-dec.h,v 1.58 2002/05/18 17:47:46 sam Exp $ * $Id: input_ext-dec.h,v 1.59 2002/05/24 12:42:14 gbazin Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr> * Michel Kaempf <maxx@via.ecp.fr>
...@@ -505,9 +505,11 @@ static inline void GetChunk( bit_stream_t * p_bit_stream, ...@@ -505,9 +505,11 @@ static inline void GetChunk( bit_stream_t * p_bit_stream,
p_buffer += i_available; p_buffer += i_available;
i_buf_len -= i_available; i_buf_len -= i_available;
BitstreamNextDataPacket( p_bit_stream ); BitstreamNextDataPacket( p_bit_stream );
if( p_bit_stream->p_decoder_fifo->b_die )
return;
} }
while( (i_available = p_bit_stream->p_end - p_bit_stream->p_byte) while( (i_available = p_bit_stream->p_end - p_bit_stream->p_byte)
<= i_buf_len && !p_bit_stream->p_decoder_fifo->b_die ); <= i_buf_len );
if( i_buf_len ) if( i_buf_len )
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (http://liba52.sf.net/). * (http://liba52.sf.net/).
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: a52.c,v 1.11 2002/05/20 15:03:32 gbazin Exp $ * $Id: a52.c,v 1.12 2002/05/24 12:42:14 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -158,6 +158,7 @@ static int decoder_Run ( decoder_config_t *p_config ) ...@@ -158,6 +158,7 @@ static int decoder_Run ( decoder_config_t *p_config )
/* get a52 frame header */ /* get a52 frame header */
GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer, 7 ); GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer, 7 );
if( p_a52_adec->p_fifo->b_die ) break;
/* check if frame is valid and get frame info */ /* check if frame is valid and get frame info */
p_a52_adec->frame_size = a52_syncinfo( p_a52_adec->p_frame_buffer, p_a52_adec->frame_size = a52_syncinfo( p_a52_adec->p_frame_buffer,
...@@ -171,7 +172,7 @@ static int decoder_Run ( decoder_config_t *p_config ) ...@@ -171,7 +172,7 @@ static int decoder_Run ( decoder_config_t *p_config )
continue; continue;
} }
if( DecodeFrame( p_a52_adec ) ) if( DecodeFrame( p_a52_adec ) && !p_a52_adec->p_fifo->b_die )
{ {
DecoderError( p_config->p_decoder_fifo ); DecoderError( p_config->p_decoder_fifo );
free( p_a52_adec ); free( p_a52_adec );
...@@ -240,9 +241,9 @@ static int DecodeFrame( a52_adec_thread_t * p_a52_adec ) ...@@ -240,9 +241,9 @@ static int DecodeFrame( a52_adec_thread_t * p_a52_adec )
} }
/* Creating the audio output fifo if not created yet */ /* Creating the audio output fifo if not created yet */
if (p_a52_adec->p_aout_fifo == NULL ) if( p_a52_adec->p_aout_fifo == NULL )
{ {
p_a52_adec->p_aout_fifo = aout_CreateFifo( AOUT_FIFO_PCM, p_a52_adec->p_aout_fifo = aout_CreateFifo( AOUT_FIFO_PCM,
p_a52_adec->i_channels, p_a52_adec->i_channels,
p_a52_adec->sample_rate, p_a52_adec->sample_rate,
AC3DEC_FRAME_SIZE * p_a52_adec->i_channels, AC3DEC_FRAME_SIZE * p_a52_adec->i_channels,
...@@ -279,6 +280,7 @@ static int DecodeFrame( a52_adec_thread_t * p_a52_adec ) ...@@ -279,6 +280,7 @@ static int DecodeFrame( a52_adec_thread_t * p_a52_adec )
/* Get the complete frame */ /* Get the complete frame */
GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer + 7, GetChunk( &p_a52_adec->bit_stream, p_a52_adec->p_frame_buffer + 7,
p_a52_adec->frame_size - 7 ); p_a52_adec->frame_size - 7 );
if( p_a52_adec->p_fifo->b_die ) return( -1 );
/* do the actual decoding now */ /* do the actual decoding now */
a52_frame( p_a52_adec->p_a52_state, p_a52_adec->p_frame_buffer, a52_frame( p_a52_adec->p_a52_state, p_a52_adec->p_frame_buffer,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.24 2002/05/17 18:01:25 stef Exp $ * $Id: ac3_spdif.c,v 1.25 2002/05/24 12:42:14 gbazin Exp $
* *
* Authors: Stphane Borel <stef@via.ecp.fr> * Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi> * Juha Yrjola <jyrjola@cc.hut.fi>
...@@ -406,6 +406,8 @@ int ac3_parse_syncinfo( ac3_spdif_thread_t *p_spdif ) ...@@ -406,6 +406,8 @@ int ac3_parse_syncinfo( ac3_spdif_thread_t *p_spdif )
/* Read sync frame */ /* Read sync frame */
GetChunk( &p_spdif->bit_stream, p_spdif->p_ac3 + 2, GetChunk( &p_spdif->bit_stream, p_spdif->p_ac3 + 2,
sizeof(sync_frame_t) - 2 ); sizeof(sync_frame_t) - 2 );
if( p_spdif->p_fifo->b_die ) return -1;
p_sync_frame = (sync_frame_t*)p_spdif->p_ac3; p_sync_frame = (sync_frame_t*)p_spdif->p_ac3;
/* Compute frame rate */ /* Compute frame rate */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread * lpcm_decoder_thread.c: lpcm decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm_adec.c,v 1.14 2002/04/19 13:56:11 sam Exp $ * $Id: lpcm_adec.c,v 1.15 2002/05/24 12:42:14 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org> * Henri Fallon <henri@videolan.org>
...@@ -191,7 +191,8 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec ) ...@@ -191,7 +191,8 @@ void DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
} }
GetChunk( &p_lpcmdec->bit_stream, p_temp, LPCMDEC_FRAME_SIZE); GetChunk( &p_lpcmdec->bit_stream, p_temp, LPCMDEC_FRAME_SIZE);
if( p_lpcmdec->p_fifo->b_die ) return;
for( i_loop = 0; i_loop < LPCMDEC_FRAME_SIZE/2; i_loop++ ) for( i_loop = 0; i_loop < LPCMDEC_FRAME_SIZE/2; i_loop++ )
{ {
buffer[2*i_loop]=p_temp[2*i_loop+1]; buffer[2*i_loop]=p_temp[2*i_loop+1];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* spu_decoder.c : spu decoder thread * spu_decoder.c : spu decoder thread
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: spu_decoder.c,v 1.23 2002/05/19 15:50:02 stef Exp $ * $Id: spu_decoder.c,v 1.24 2002/05/24 12:42:14 gbazin Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Rudolf Cornelissen <rag.cornelissen@inter.nl.net> * Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
...@@ -320,11 +320,12 @@ static void ParsePacket( spudec_thread_t *p_spudec ) ...@@ -320,11 +320,12 @@ static void ParsePacket( spudec_thread_t *p_spudec )
} }
/* Get RLE data */ /* Get RLE data */
for( i_offset = 0; for( i_offset = 0; i_offset < p_spudec->i_rle_size;
i_offset + SPU_CHUNK_SIZE < p_spudec->i_rle_size;
i_offset += SPU_CHUNK_SIZE ) i_offset += SPU_CHUNK_SIZE )
{ {
GetChunk( &p_spudec->bit_stream, p_src + i_offset, SPU_CHUNK_SIZE ); GetChunk( &p_spudec->bit_stream, p_src + i_offset,
( i_offset + SPU_CHUNK_SIZE < p_spudec->i_rle_size ) ?
SPU_CHUNK_SIZE : p_spudec->i_rle_size - i_offset );
/* Abort subtitle parsing if we were requested to stop */ /* Abort subtitle parsing if we were requested to stop */
if( p_spudec->p_fifo->b_die ) if( p_spudec->p_fifo->b_die )
...@@ -335,9 +336,6 @@ static void ParsePacket( spudec_thread_t *p_spudec ) ...@@ -335,9 +336,6 @@ static void ParsePacket( spudec_thread_t *p_spudec )
} }
} }
GetChunk( &p_spudec->bit_stream, p_src + i_offset,
p_spudec->i_rle_size - i_offset );
#if 0 #if 0
/* Dump the subtitle info */ /* Dump the subtitle info */
intf_WarnHexDump( 5, p_spu->p_sys->p_data, p_spudec->i_rle_size ); intf_WarnHexDump( 5, p_spu->p_sys->p_data, p_spudec->i_rle_size );
...@@ -1202,4 +1200,3 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic, ...@@ -1202,4 +1200,3 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
break; break;
} }
} }
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