Commit 88345052 authored by Laurent Aimar's avatar Laurent Aimar

Fixed memory leak of 1 audio(video?) buffer when quitting.

parent 14cc9765
...@@ -625,9 +625,13 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -625,9 +625,13 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) ) while( (p_aout_buf = p_dec->pf_decode_audio( p_dec, &p_block )) )
{ {
aout_instance_t *p_aout = p_dec->p_owner->p_aout;
aout_input_t *p_aout_input = p_dec->p_owner->p_aout_input;
if( p_dec->b_die ) if( p_dec->b_die )
{ {
/* It prevent freezing VLC in case of broken decoder */ /* It prevent freezing VLC in case of broken decoder */
aout_DecDeleteBuffer( p_aout, p_aout_input, p_aout_buf );
if( p_block ) if( p_block )
block_Release( p_block ); block_Release( p_block );
break; break;
...@@ -638,8 +642,7 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -638,8 +642,7 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
if( p_aout_buf->start_date < p_dec->p_owner->i_preroll_end ) if( p_aout_buf->start_date < p_dec->p_owner->i_preroll_end )
{ {
aout_DecDeleteBuffer( p_dec->p_owner->p_aout, aout_DecDeleteBuffer( p_aout, p_aout_input, p_aout_buf );
p_dec->p_owner->p_aout_input, p_aout_buf );
continue; continue;
} }
...@@ -649,9 +652,7 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block ) ...@@ -649,9 +652,7 @@ static void DecoderDecodeAudio( decoder_t *p_dec, block_t *p_block )
msg_Dbg( p_dec, "End of audio preroll" ); msg_Dbg( p_dec, "End of audio preroll" );
p_dec->p_owner->i_preroll_end = -1; p_dec->p_owner->i_preroll_end = -1;
} }
aout_DecPlay( p_dec->p_owner->p_aout, aout_DecPlay( p_aout, p_aout_input, p_aout_buf, i_rate );
p_dec->p_owner->p_aout_input,
p_aout_buf, i_rate );
} }
} }
static void DecoderGetCc( decoder_t *p_dec, decoder_t *p_dec_cc ) static void DecoderGetCc( decoder_t *p_dec, decoder_t *p_dec_cc )
...@@ -836,9 +837,11 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block ) ...@@ -836,9 +837,11 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) ) while( (p_pic = p_dec->pf_decode_video( p_dec, &p_block )) )
{ {
vout_thread_t *p_vout = p_dec->p_owner->p_vout;
if( p_dec->b_die ) if( p_dec->b_die )
{ {
/* It prevent freezing VLC in case of broken decoder */ /* It prevent freezing VLC in case of broken decoder */
VoutDisplayedPicture( p_vout, p_pic );
if( p_block ) if( p_block )
block_Release( p_block ); block_Release( p_block );
break; break;
...@@ -850,15 +853,15 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block ) ...@@ -850,15 +853,15 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
if( p_pic->date < p_dec->p_owner->i_preroll_end ) if( p_pic->date < p_dec->p_owner->i_preroll_end )
{ {
VoutDisplayedPicture( p_dec->p_owner->p_vout, p_pic ); VoutDisplayedPicture( p_vout, p_pic );
continue; continue;
} }
if( p_dec->p_owner->i_preroll_end > 0 ) if( p_dec->p_owner->i_preroll_end > 0 )
{ {
msg_Dbg( p_dec, "End of video preroll" ); msg_Dbg( p_dec, "End of video preroll" );
if( p_dec->p_owner->p_vout ) if( p_vout )
VoutFlushPicture( p_dec->p_owner->p_vout ); VoutFlushPicture( p_vout );
/* */ /* */
p_dec->p_owner->i_preroll_end = -1; p_dec->p_owner->i_preroll_end = -1;
} }
...@@ -866,12 +869,11 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block ) ...@@ -866,12 +869,11 @@ static void DecoderDecodeVideo( decoder_t *p_dec, block_t *p_block )
if( ( !p_dec->p_owner->p_packetizer || !p_dec->p_owner->p_packetizer->pf_get_cc ) && p_dec->pf_get_cc ) if( ( !p_dec->p_owner->p_packetizer || !p_dec->p_owner->p_packetizer->pf_get_cc ) && p_dec->pf_get_cc )
DecoderGetCc( p_dec, p_dec ); DecoderGetCc( p_dec, p_dec );
vout_DatePicture( p_dec->p_owner->p_vout, p_pic, vout_DatePicture( p_vout, p_pic, p_pic->date );
p_pic->date );
optimize_video_pts( p_dec ); optimize_video_pts( p_dec );
vout_DisplayPicture( p_dec->p_owner->p_vout, p_pic ); vout_DisplayPicture( p_vout, p_pic );
} }
} }
......
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