Commit ce0b8f58 authored by Gildas Bazin's avatar Gildas Bazin

* modules/codec/faad/decoder.c: for some reason my libfaad the frame samplerate to 0. I guess I should update it but anyway a sanity check avoids a segfault in this case.
parent e656b0b4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* decoder.c: AAC decoder using libfaad2 * decoder.c: AAC decoder using libfaad2
***************************************************************************** *****************************************************************************
* Copyright (C) 2001, 2002 VideoLAN * Copyright (C) 2001, 2002 VideoLAN
* $Id: decoder.c,v 1.28 2003/08/24 00:34:13 hartman Exp $ * $Id: decoder.c,v 1.29 2003/08/24 23:22:02 gbazin Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -381,9 +381,9 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -381,9 +381,9 @@ static void DecodeThread( adec_thread_t *p_adec )
} }
#if 0 #if 0
msg_Dbg( p_adec->p_fifo, msg_Err( p_adec->p_fifo,
"decoded frame samples:%d, channels:%d, consumed:%d", "decoded frame samples:%d, rate:%d, channels:%d, consumed:%d",
faad_frame.samples, faad_frame.samples, faad_frame.samplerate,
faad_frame.channels, faad_frame.channels,
faad_frame.bytesconsumed ); faad_frame.bytesconsumed );
#endif #endif
...@@ -392,10 +392,12 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -392,10 +392,12 @@ static void DecodeThread( adec_thread_t *p_adec )
/* **** Now we can output these samples **** */ /* **** Now we can output these samples **** */
/* **** First check if we have a valid output **** */ /* **** First check if we have a valid output **** */
if( ( !p_adec->p_aout_input )|| if( !p_adec->p_aout_input ||
( p_adec->output_format.i_original_channels != pi_channels_maps[faad_frame.channels] ) p_adec->output_format.i_original_channels
!= pi_channels_maps[faad_frame.channels] ||
#ifndef HAVE_OLD_FAAD2 #ifndef HAVE_OLD_FAAD2
|| ( p_adec->output_format.i_rate != faad_frame.samplerate ) ( faad_frame.samplerate &&
p_adec->output_format.i_rate != faad_frame.samplerate )
#endif #endif
) )
{ {
...@@ -410,6 +412,7 @@ static void DecodeThread( adec_thread_t *p_adec ) ...@@ -410,6 +412,7 @@ static void DecodeThread( adec_thread_t *p_adec )
p_adec->output_format.i_original_channels = p_adec->output_format.i_original_channels =
pi_channels_maps[faad_frame.channels]; pi_channels_maps[faad_frame.channels];
#ifndef HAVE_OLD_FAAD2 #ifndef HAVE_OLD_FAAD2
if( faad_frame.samplerate )
p_adec->output_format.i_rate = faad_frame.samplerate; p_adec->output_format.i_rate = faad_frame.samplerate;
#endif #endif
......
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