Atrac: Revert broken seeking fix.

This wasn't the right solution to getting the right packets.
This commit is contained in:
Unknown W. Brackets
2016-01-02 11:12:35 -08:00
parent 61075d6ac8
commit 6fe5fe07a4
+4 -4
View File
@@ -292,7 +292,7 @@ struct Atrac {
}
u32 getFileOffsetBySample(int sample) const {
int offsetSample = sample + firstSampleoffset + firstOffsetExtra();
int offsetSample = sample + firstSampleoffset;
int frameOffset = offsetSample / (int)samplesPerFrame();
return (u32)(dataOff + atracBytesPerFrame + frameOffset * atracBytesPerFrame);
}
@@ -312,7 +312,7 @@ struct Atrac {
}
// Since the first frame is shorter by this offset, add to round up at this offset.
const int remainingBytes = first.fileoffset - getFileOffsetBySample(currentSample - samplesPerFrame());
const int remainingBytes = first.fileoffset - getFileOffsetBySample(currentSample - samplesPerFrame() + firstOffsetExtra());
return remainingBytes / atracBytesPerFrame;
}
@@ -1154,7 +1154,7 @@ static void AtracGetResetBufferInfo(Atrac *atrac, AtracResetBufferInfo *bufferIn
// This is because we're filling the buffer start to finish, not streaming.
bufferInfo->first.writePosPtr = atrac->first.addr + atrac->first.size;
bufferInfo->first.writableBytes = atrac->first.filesize - atrac->first.size;
int minWriteBytes = atrac->getFileOffsetBySample(sample - atrac->firstOffsetExtra()) - atrac->first.size;
int minWriteBytes = atrac->getFileOffsetBySample(sample) - atrac->first.size;
if (minWriteBytes > 0) {
bufferInfo->first.minWriteBytes = minWriteBytes;
} else {
@@ -1165,7 +1165,7 @@ static void AtracGetResetBufferInfo(Atrac *atrac, AtracResetBufferInfo *bufferIn
atrac->first.writableBytes = bufferInfo->first.writableBytes;
} else {
// This is without the sample offset. The file offset also includes the previous batch of samples?
int sampleFileOffset = atrac->getFileOffsetBySample(sample - atrac->firstSampleoffset - atrac->samplesPerFrame() - atrac->firstOffsetExtra());
int sampleFileOffset = atrac->getFileOffsetBySample(sample - atrac->firstSampleoffset - atrac->samplesPerFrame());
// Update the writable bytes. When streaming, this is just the number of bytes until the end.
const u32 bufSizeAligned = (atrac->atracBufSize / atrac->atracBytesPerFrame) * atrac->atracBytesPerFrame;