mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Avoid searching the same area twice in MPEG::File::previousFrameOffset().
This commit is contained in:
parent
87fc4012f4
commit
ba98628919
@ -373,15 +373,13 @@ long MPEG::File::previousFrameOffset(long position)
|
||||
ByteVector frameSyncBytes(2, '\0');
|
||||
|
||||
while(position > 0) {
|
||||
const long size = std::min<long>(position, bufferSize());
|
||||
position -= size;
|
||||
const long bufferLength = std::min<long>(position, bufferSize());
|
||||
position -= bufferLength;
|
||||
|
||||
seek(position);
|
||||
const ByteVector buffer = readBlock(bufferSize());
|
||||
if(buffer.isEmpty())
|
||||
return -1;
|
||||
const ByteVector buffer = readBlock(bufferLength);
|
||||
|
||||
for(int i = buffer.size() - 1; i >= 0; i--) {
|
||||
for(int i = buffer.size() - 1; i >= 0; --i) {
|
||||
frameSyncBytes[1] = frameSyncBytes[0];
|
||||
frameSyncBytes[0] = buffer[i];
|
||||
if(isFrameSync(frameSyncBytes)) {
|
||||
|
Loading…
Reference in New Issue
Block a user