decoder_t *p_dec = (decoder_t *)p_this;
decoder_sys_t *p_sys = p_dec->p_sys;
+ block_BytestreamRelease( &p_sys->bytestream );
free( p_sys );
}
bs_t bs;
- if( !p_dec->fmt_in.i_extra )
+ if( p_dec->fmt_in.i_extra < 8 + 14 )
return;
- bs_init( &bs, p_dec->fmt_in.p_extra, p_dec->fmt_in.i_extra );
+ bs_init( &bs, (uint8_t*)p_dec->fmt_in.p_extra + 8, p_dec->fmt_in.i_extra - 8 );
p_sys->stream_info.min_blocksize = bs_read( &bs, 16 );
p_sys->stream_info.max_blocksize = bs_read( &bs, 16 );
date_Set( &p_sys->end_date, p_sys->i_pts );
}
p_sys->i_state = STATE_NEXT_SYNC;
- p_sys->i_frame_size = 1;
+ p_sys->i_frame_size = p_sys->b_stream_info && p_sys->stream_info.min_framesize > 0 ?
+ p_sys->stream_info.min_framesize : 1;
case STATE_NEXT_SYNC:
/* TODO: If pp_block == NULL, flush the buffer without checking the
if( p_sys->i_state != STATE_SEND_DATA )
{
+ if( p_sys->b_stream_info && p_sys->stream_info.max_framesize > 0 &&
+ p_sys->i_frame_size > p_sys->stream_info.max_framesize )
+ {
+ block_SkipByte( &p_sys->bytestream );
+ p_sys->i_state = STATE_NOSYNC;
+ return NULL;
+ }
/* Need more data */
return NULL;
}