[FLAC Decoder] Correctly handle zero length frames
Apparently, the decoder is capable of returning zero length frames without having hit the end of the stream. Signed-off-by: Christopher Snowhill <kode54@gmail.com>main
parent
32ec11a42e
commit
27a1153b91
|
@ -365,6 +365,7 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
|||
id audioChunkClass = NSClassFromString(@"AudioChunk");
|
||||
AudioChunk *chunk = nil;
|
||||
|
||||
while (blockBufferFrames <= 0) {
|
||||
if(FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
|
||||
return nil;
|
||||
}
|
||||
|
@ -372,6 +373,7 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
|||
if(!FLAC__stream_decoder_process_single(decoder)) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
if(blockBufferFrames > 0) {
|
||||
chunk = [[audioChunkClass alloc] initWithProperties:[self properties]];
|
||||
|
|
Loading…
Reference in New Issue