[vlc-devel] [PATCH] flac: move CRC update into STATE_NEXT_SYNC

Tristan Matthews le.businessman at gmail.com
Mon Dec 9 19:47:06 CET 2013


On Fri, Dec 6, 2013 at 10:50 AM, Rafaël Carré <funman at videolan.org> wrote:
> Le 06/12/2013 16:07, Tristan Matthews a écrit :
>> Fixes #9966.
>> ---
>>  modules/packetizer/flac.c | 9 ++++++---
>>  1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/modules/packetizer/flac.c b/modules/packetizer/flac.c
>> index 2f16717..b5af285 100644
>> --- a/modules/packetizer/flac.c
>> +++ b/modules/packetizer/flac.c
>> @@ -572,6 +572,11 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
>>          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
>> +         * next sync word */
>> +
>> +    {
>
> Looks good, but won't this calculate the crc for each incoming packet
> needed until we reach the next sync?

Do you mean, will this lead to more crc calculations than before?

>
> Not sure if there's an easy way around this without changing
> block_helper.h though

What would need to be changed in block_helper, a function to do partial reads?

Best,
Tristan

>>          /* Calculate the initial CRC for the minimal frame size,
>>           * We'll update it as we look for the next start code. */
>>          uint8_t *buf = malloc(p_sys->i_frame_size);
>> @@ -588,10 +593,8 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
>>              crc = flac_crc16(crc, buf[i]);
>>          free(buf);
>>          p_sys->crc = crc;
>> +    }
>>
>> -    case STATE_NEXT_SYNC:
>> -        /* TODO: If pp_block == NULL, flush the buffer without checking the
>> -         * next sync word */
>>
>>          /* Check if next expected frame contains the sync word */
>>          while (!block_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_frame_size,
>>
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



-- 
Tristan Matthews
web: http://tristanswork.blogspot.com



More information about the vlc-devel mailing list