As with Video-encoders, audio encoder can flush buffers in that case.
Currently avcodec doesn't handle flushing and other encoders in this
changeset (flac,speex,twolame,vorbis) have only boilerplate to check
against NULL input so they don't crash.
block_t *p_block, *p_chain = NULL;
+ /*FIXME: change to use avcodec_encode_audio2 to be able to flush*/
+ if( unlikely( !p_aout_buf ) ) return NULL;
+
uint8_t *p_buffer = p_aout_buf->p_buffer;
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
block_t *p_chain;
unsigned int i;
+ /* FIXME: p_aout_buf is NULL when it's time to flush*/
+ if( unlikely( !p_aout_buf ) ) return NULL;
+
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
encoder_sys_t *p_sys = p_enc->p_sys;
block_t *p_block, *p_chain = NULL;
+ /* Encoder gets NULL when it's time to flush */
+ if( unlikely( !p_aout_buf ) ) return NULL;
+
unsigned char *p_buffer = p_aout_buf->p_buffer;
int i_samples = p_aout_buf->i_nb_samples;
int i_samples_delay = p_sys->i_samples_delay;
static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
{
encoder_sys_t *p_sys = p_enc->p_sys;
+
+ /* FIXME:p_aout_buf is NULL when it's time to flush, does twolame has buffer to flush?*/
+ if( unlikely( !p_aout_buf ) ) return NULL;
+
int16_t *p_buffer = (int16_t *)p_aout_buf->p_buffer;
int i_nb_samples = p_aout_buf->i_nb_samples;
block_t *p_chain = NULL;
block_t *p_block, *p_chain = NULL;
float **buffer;
+ /* FIXME: flush buffers in here */
+ if( unlikely( !p_aout_buf ) ) return NULL;
+
mtime_t i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
switch( id->p_decoder->fmt_in.i_cat )
{
case AUDIO_ES:
+ Send( p_stream, id, NULL );
transcode_audio_close( id );
break;
case VIDEO_ES: