[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>xcode15
parent
c4e975319a
commit
68d323545b
|
@ -365,12 +365,14 @@ void ErrorCallback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorS
|
||||||
id audioChunkClass = NSClassFromString(@"AudioChunk");
|
id audioChunkClass = NSClassFromString(@"AudioChunk");
|
||||||
AudioChunk *chunk = nil;
|
AudioChunk *chunk = nil;
|
||||||
|
|
||||||
if(FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
|
while (blockBufferFrames <= 0) {
|
||||||
return nil;
|
if(FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) {
|
||||||
}
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
if(!FLAC__stream_decoder_process_single(decoder)) {
|
if(!FLAC__stream_decoder_process_single(decoder)) {
|
||||||
return nil;
|
return nil;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blockBufferFrames > 0) {
|
if(blockBufferFrames > 0) {
|
||||||
|
|
Loading…
Reference in New Issue