Skip to content

Commit a1ce710

Browse files
authored
Merge pull request #3383 from florianessl/fix/Mp3Heuristic
Fix MP3 heuristic check
2 parents b1ae9a7 + 78d9df6 commit a1ce710

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/decoder_mpg123.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,8 @@ bool Mpg123Decoder::IsMp3(Filesystem_Stream::InputStream& stream) {
230230
// Read beginning of assumed MP3 file and count errors as an heuristic to detect MP3
231231
for (int i = 0; i < 10; ++i) {
232232
err = mpg123_read(decoder.handle.get(), buffer, 1024, &done);
233-
if (err == MPG123_DONE) {
234-
return true;
233+
if (err == MPG123_DONE && done != 0) {
234+
return err_count == 0;
235235
}
236236
if (err != MPG123_OK) {
237237
err_count += 1;

0 commit comments

Comments
 (0)