[Flac-dev] Problem with CRAM and flac-1.1.2

Josh Green josh at resonance.org
Mon Jul 24 21:37:18 PDT 2006


A user of CRAM (http://swami.sourceforge.net/cram.php) sent in a bug
report related to decoding of CRAM files.  This issue occurs with
flac-1.1.2 but not previous versions (such as flac-1.1.1).  Note that
the same file is used for this test (hopefully ruling out any issue with
the encoder).

Details of the issue:

When calling FLAC__stream_decoder_process_single() the error callback is
triggered with the error FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER
(the error callback is from line 1806 of stream_decoder.c in
read_frame_).  One thing I noticed is that
FLAC__stream_decoder_process_single() still returns TRUE when our read
callback returns FLAC__STREAM_DECODER_ABORTED (this was previously
causing an endless loop in CRAM, since it didn't detect that an error
had occurred).  This behavior doesn't seem quite right and is contrary
to what is described in the API docs (says the only error which returns
TRUE is FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC).  Seems like
returning FALSE might be more intuitive.

Some details of how CRAM uses FLAC:
- using libFLAC stream encoder/decoder
- many samples are encoded/decoded in the same file using the same
encoder/decoder instance (the individual sample formats may differ but
the block size is fixed currently)
- CRAM uses its own container format (EBML)
- FLAC header is forged in the read_callback (isn't actually written to
CRAM file)

If anyone has any ideas on how this issue can be resolved I'd appreciate
the input.  In particular this is related to some change between version
1.1.1 and 1.1.2 of FLAC.  I'll continue to try and narrow down what
exactly it is.  Best regards,
	Josh Green




More information about the Flac-dev mailing list