Commit 1967b52d authored by Laurent Aimar's avatar Laurent Aimar

Fixed a few errors in flac packetizer.

parent 447327c6
......@@ -145,6 +145,7 @@ static void Close( vlc_object_t *p_this )
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 );
}
......@@ -157,10 +158,10 @@ static void ProcessHeader( decoder_t *p_dec )
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 );
......@@ -288,7 +289,8 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
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
......@@ -320,6 +322,13 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
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;
}
......
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