Fix playback after seek (#273)

Use estimated byte offset (if available) instead
of calculated byte offset
This commit is contained in:
derpoliuk
2017-03-29 11:44:48 +03:00
parent 2d251d5150
commit 6d00aa0dff
+1 -7
View File
@@ -1497,14 +1497,8 @@ static void AudioFileStreamPacketsProc(void* clientData, UInt32 numberBytes, UIn
error = AudioFileStreamSeek(audioFileStream, seekPacket, &packetAlignedByteOffset, &ioFlags);
if (!error && !(ioFlags & kAudioFileStreamSeekFlag_OffsetIsEstimated))
if (!error && (ioFlags & kAudioFileStreamSeekFlag_OffsetIsEstimated))
{
double delta = ((seekByteOffset - (SInt64)currentEntry->audioDataOffset) - packetAlignedByteOffset) / calculatedBitRate * 8;
OSSpinLockLock(&currentEntry->spinLock);
currentEntry->seekTime -= delta;
OSSpinLockUnlock(&currentEntry->spinLock);
seekByteOffset = packetAlignedByteOffset + currentEntry->audioDataOffset;
}
}