Commit 540107f5 authored by Laurent Aimar's avatar Laurent Aimar

*ffmpeg: split huge audio packets as aout didn't like them.

parent bfefedf7
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* audio.c: audio decoder using ffmpeg library * audio.c: audio decoder using ffmpeg library
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: audio.c,v 1.16 2003/04/20 11:57:13 gbazin Exp $ * $Id: audio.c,v 1.17 2003/04/25 17:35:52 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -167,6 +167,8 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec ) ...@@ -167,6 +167,8 @@ void E_( DecodeThread_Audio )( adec_thread_t *p_adec )
int i_frame_size; int i_frame_size;
int i_used; int i_used;
uint8_t *p;
do do
{ {
input_ExtractPES( p_adec->p_fifo, &p_pes ); input_ExtractPES( p_adec->p_fifo, &p_pes );
...@@ -296,9 +298,16 @@ usenextdata: ...@@ -296,9 +298,16 @@ usenextdata:
return; return;
} }
p = &p_adec->p_output[0];
while( i_samplesperchannel > 0 )
{
int i_samples;
i_samples = __MIN( 1000, i_samplesperchannel );
p_aout_buffer = aout_DecNewBuffer( p_adec->p_aout, p_aout_buffer = aout_DecNewBuffer( p_adec->p_aout,
p_adec->p_aout_input, p_adec->p_aout_input,
i_samplesperchannel ); i_samples );
if( !p_aout_buffer ) if( !p_aout_buffer )
{ {
msg_Err( p_adec->p_fifo, "cannot get aout buffer" ); msg_Err( p_adec->p_fifo, "cannot get aout buffer" );
...@@ -308,13 +317,19 @@ usenextdata: ...@@ -308,13 +317,19 @@ usenextdata:
p_aout_buffer->start_date = aout_DateGet( &p_adec->date ); p_aout_buffer->start_date = aout_DateGet( &p_adec->date );
p_aout_buffer->end_date = aout_DateIncrement( &p_adec->date, p_aout_buffer->end_date = aout_DateIncrement( &p_adec->date,
i_samplesperchannel ); i_samples );
memcpy( p_aout_buffer->p_buffer, memcpy( p_aout_buffer->p_buffer,
p_adec->p_output, p,
p_aout_buffer->i_nb_bytes ); p_aout_buffer->i_nb_bytes );
aout_DecPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer ); aout_DecPlay( p_adec->p_aout, p_adec->p_aout_input, p_aout_buffer );
p += i_samples * 2 * aout_FormatNbChannels( &p_adec->output_format );
i_samplesperchannel -= i_samples;
// msg_Dbg( p_adec->p_fifo, "p_aout_buffer->i_nb_bytes=%d c*2*i_samples=%d", p_aout_buffer->i_nb_bytes, i_samples * 2 * aout_FormatNbChannels( &p_adec->output_format ) );
}
if( i_frame_size > 0 ) if( i_frame_size > 0 )
{ {
goto usenextdata; goto usenextdata;
......
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