mirror of
https://github.com/taglib/taglib.git
synced 2025-06-03 00:58:12 -04:00
fix reading audioproperties for broken mp3 files
This commit is contained in:
parent
a80093167f
commit
2d90d938fe
@ -200,13 +200,14 @@ void MPEG::Properties::read(File *file)
|
||||
const long lastFrameOffset = file->lastFrameOffset();
|
||||
if(lastFrameOffset < 0) {
|
||||
debug("MPEG::Properties::read() -- Could not find an MPEG frame in the stream.");
|
||||
return;
|
||||
}
|
||||
|
||||
const Header lastHeader(file, lastFrameOffset, false);
|
||||
const long streamLength = lastFrameOffset - firstFrameOffset + lastHeader.frameLength();
|
||||
if(streamLength > 0)
|
||||
d->length = static_cast<int>(streamLength * 8.0 / d->bitrate + 0.5);
|
||||
else
|
||||
{
|
||||
const Header lastHeader(file, lastFrameOffset, false);
|
||||
const long streamLength = lastFrameOffset - firstFrameOffset + lastHeader.frameLength();
|
||||
if (streamLength > 0)
|
||||
d->length = static_cast<int>(streamLength * 8.0 / d->bitrate + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
d->sampleRate = firstHeader.sampleRate();
|
||||
|
Loading…
x
Reference in New Issue
Block a user