Ported error handling from the previous Audjustable player.
STKDataSource is designed to return values < 0 in case of error, but new STKAudioPlayer doesn't handle that, which causes crash few lines later when calling AudioFileStreamParseBytes with read<0.
This commit is contained in:
parent
6eb149f83a
commit
9aed1b082a
|
|
@ -1470,6 +1470,17 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
|
|||
}
|
||||
}
|
||||
|
||||
if (read < 0)
|
||||
{
|
||||
// iOS will shutdown network connections if the app is backgrounded (i.e. device is locked when player is paused)
|
||||
// We try to reopen -- should probably add a back-off protocol in the future
|
||||
|
||||
long long position = currentlyReadingEntry.dataSource.position;
|
||||
[currentlyReadingEntry.dataSource seekToOffset:position];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int flags = 0;
|
||||
|
||||
if (discontinuous)
|
||||
|
|
|
|||
Loading…
Reference in New Issue