Commit d1da2a1a authored by Tristan Matthews's avatar Tristan Matthews

flac: move CRC update into STATE_NEXT_SYNC

Fixes #9966.
parent e1bdb390
...@@ -572,6 +572,11 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block) ...@@ -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->i_frame_size = p_sys->b_stream_info && p_sys->stream_info.min_framesize > 0 ?
p_sys->stream_info.min_framesize : 1; 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 */
{
/* Calculate the initial CRC for the minimal frame size, /* Calculate the initial CRC for the minimal frame size,
* We'll update it as we look for the next start code. */ * We'll update it as we look for the next start code. */
uint8_t *buf = malloc(p_sys->i_frame_size); 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) ...@@ -588,10 +593,8 @@ static block_t *Packetize(decoder_t *p_dec, block_t **pp_block)
crc = flac_crc16(crc, buf[i]); crc = flac_crc16(crc, buf[i]);
free(buf); free(buf);
p_sys->crc = crc; 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 */ /* Check if next expected frame contains the sync word */
while (!block_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_frame_size, while (!block_PeekOffsetBytes(&p_sys->bytestream, p_sys->i_frame_size,
......
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