Fix FLAC seeking when the last seek point is a placeholder

PiperOrigin-RevId: 285449865
This commit is contained in:
olly 2019-12-13 20:29:54 +00:00 committed by Oliver Woodman
parent b3f485d7d9
commit 8bafd6ff7d

View File

@ -462,8 +462,9 @@ bool FLACParser::getSeekPositions(int64_t timeUs,
if (sampleNumber <= targetSampleNumber) { if (sampleNumber <= targetSampleNumber) {
result[0] = (sampleNumber * 1000000LL) / sampleRate; result[0] = (sampleNumber * 1000000LL) / sampleRate;
result[1] = firstFrameOffset + points[i - 1].stream_offset; result[1] = firstFrameOffset + points[i - 1].stream_offset;
if (sampleNumber == targetSampleNumber || i >= length) { if (sampleNumber == targetSampleNumber || i >= length ||
// exact seek, or no following seek point. points[i].sample_number == -1) { // placeholder
// exact seek, or no following non-placeholder seek point
result[2] = result[0]; result[2] = result[0];
result[3] = result[1]; result[3] = result[1];
} else { } else {