Commit 96f414c1 authored by Michel Kaempf's avatar Michel Kaempf

* include/audio_output.h :

- Correction d'une erreur dans la taille des frames du Layer II (1152
et non 1192) (ne vous en faites pas, l'erreur n'�tait pr�sente que dans
un commentaire :-) ;

* audio_decoder/audio_decoder.c :
- Rajout d'un certain nombre de commentaires utiles pour la suite du
d�veloppement de l'audio_decoder ;
- Modification de la m�thode de calcul du nombre de frames audio libres
dans l'aout_fifo (� tester !) ;

-- MaXX
parent b8d92165
......@@ -38,7 +38,7 @@
/* Number of audio samples (s16 integers) contained in an audio output frame...
* - Layer I : a decoded frame contains 384 samples
* - Layer II & III : a decoded frame contains 1192 = 3*384 samples */
* - Layer II & III : a decoded frame contains 1152 = 3*384 samples */
#define AOUT_FRAME_SIZE 384
/* Number of audio output frames contained in an audio output fifo.
......
......@@ -816,6 +816,7 @@ static void RunThread( adec_thread_t * p_adec )
}
else
{
/* adec_Layer2_Stereo() produces 6 output frames (2*1152/384) */
// i_header = p_adec->bit_stream.fifo.buffer;
// i_framesize = pi_framesize[ 128*((i_header & ADEC_HEADER_LAYER_MASK) >> ADEC_HEADER_LAYER_SHIFT) +
// 64*((i_header & ADEC_HEADER_PADDING_BIT_MASK) >> ADEC_HEADER_PADDING_BIT_SHIFT) +
......@@ -834,7 +835,8 @@ static void RunThread( adec_thread_t * p_adec )
// }
pthread_mutex_lock( &p_adec->p_aout_fifo->data_lock );
while ( (((p_adec->p_aout_fifo->l_end_frame + 6) - p_adec->p_aout_fifo->l_start_frame) & AOUT_FIFO_SIZE) < 6 ) /* !! */
/* (((end + 6) - start) & AOUT_FIFO_SIZE) < 6 */
while ( ((p_adec->p_aout_fifo->l_start_frame - p_adec->p_aout_fifo->l_end_frame) & AOUT_FIFO_SIZE) < 6 ) /* !! */
{
pthread_cond_wait( &p_adec->p_aout_fifo->data_wait, &p_adec->p_aout_fifo->data_lock );
}
......@@ -845,29 +847,24 @@ static void RunThread( adec_thread_t * p_adec )
pthread_mutex_lock( &p_adec->p_aout_fifo->data_lock );
/* Frame 1 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = adec_date;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
/* Frame 2 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
/* Frame 3 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
/* Frame 4 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
/* Frame 5 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
/* Frame 6 */
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
p_adec->p_aout_fifo->l_end_frame += 1;
p_adec->p_aout_fifo->l_end_frame &= AOUT_FIFO_SIZE;
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
pthread_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
/* 24000 == 6*384/2/48000*1000000 */
adec_date += 24000; /* !! */
}
}
......
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