Set aout_buffer_t.b_discontinuity in mpeg audio packetizer.
Silent first 3 frames on discontinuity in mad decoder.
(close #590)
size_t i_size, i_nb_bytes;
unsigned int i_nb_samples;
mtime_t start_date, end_date;
+ vlc_bool_t b_discontinuity; /* Set on discontinuity (for non pcm stream) */
struct aout_buffer_t * p_next;
void (*pf_release)( aout_buffer_t * );
};
-#define aout_BufferFree( p_buffer ) \
+#define aout_BufferFree( p_buffer ) do { \
if( p_buffer != NULL && (p_buffer)->i_alloc_type == AOUT_ALLOC_HEAP ) \
{ \
free( p_buffer ); \
} \
- p_buffer = NULL;
+ p_buffer = NULL; } while(0)
/* Size of a frame for S/PDIF output. */
#define AOUT_SPDIF_SIZE 6144
struct filter_sys_t
{
struct mad_stream mad_stream;
- struct mad_frame mad_frame;
- struct mad_synth mad_synth;
+ struct mad_frame mad_frame;
+ struct mad_synth mad_synth;
+
+ int i_reject_count;
};
/*****************************************************************************
mad_frame_init( &p_sys->mad_frame );
mad_synth_init( &p_sys->mad_synth );
mad_stream_options( &p_sys->mad_stream, MAD_OPTION_IGNORECRC );
+ p_sys->i_reject_count = 0;
p_filter->pf_do_work = DoWork;
p_filter->b_in_place = 0;
{
msg_Dbg( p_aout, "libmad error: %s",
mad_stream_errorstr( &p_sys->mad_stream ) );
+ p_sys->i_reject_count = 3;
+ }
+ else if( p_in_buf->b_discontinuity )
+ {
+ p_sys->i_reject_count = 3;
+ }
+
+ if( p_sys->i_reject_count > 0 )
+ {
if( p_filter->output.i_format == VLC_FOURCC('f','l','3','2') )
{
int i;
{
memset( p_out_buf->p_buffer, 0, p_out_buf->i_nb_bytes );
}
+ p_sys->i_reject_count--;
return;
}
+
mad_synth_frame( &p_sys->mad_synth, &p_sys->mad_frame );
if ( p_filter->output.i_format == VLC_FOURCC('f','i','3','2') )
unsigned int i_channels_conf, i_channels;
unsigned int i_rate, i_max_frame_size, i_frame_length;
unsigned int i_layer, i_bit_rate;
+
+ vlc_bool_t b_discontinuity;
};
enum {
p_sys->i_state = STATE_NOSYNC;
aout_DateSet( &p_sys->end_date, 0 );
p_sys->bytestream = block_BytestreamInit( p_dec );
+ p_sys->b_discontinuity = VLC_FALSE;
/* Set output properties */
p_dec->fmt_out.i_cat = AUDIO_ES;
}
// aout_DateSet( &p_sys->end_date, 0 );
block_Release( *pp_block );
+ p_sys->b_discontinuity = VLC_TRUE;
return NULL;
}
msg_Dbg( p_dec, "emulated startcode" );
block_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
+ p_sys->b_discontinuity = VLC_TRUE;
break;
}
msg_Dbg( p_dec, "emulated startcode on next frame" );
block_SkipByte( &p_sys->bytestream );
p_sys->i_state = STATE_NOSYNC;
+ p_sys->b_discontinuity = VLC_TRUE;
break;
}
p_buf->start_date = aout_DateGet( &p_sys->end_date );
p_buf->end_date =
aout_DateIncrement( &p_sys->end_date, p_sys->i_frame_length );
+ p_buf->b_discontinuity = p_sys->b_discontinuity;
+ p_sys->b_discontinuity = VLC_FALSE;
/* Hack for libmad filter */
p_buf->i_nb_bytes = p_sys->i_frame_size + MAD_BUFFER_GUARD;
(p_new_buffer)->i_size = i_alloc_size; \
(p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \
+ sizeof(aout_buffer_t); \
+ (p_new_buffer)->b_discontinuity = VLC_FALSE; \
if ( (p_previous_buffer) != NULL ) \
{ \
(p_new_buffer)->start_date = \