Fix playback after seek (#273)
Use estimated byte offset (if available) instead of calculated byte offset
This commit is contained in:
@@ -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(¤tEntry->spinLock);
|
||||
currentEntry->seekTime -= delta;
|
||||
OSSpinLockUnlock(¤tEntry->spinLock);
|
||||
|
||||
seekByteOffset = packetAlignedByteOffset + currentEntry->audioDataOffset;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user