decoder/faad: check sample_rate, not frames_per_second
Checking the integer is faster, easier and more reliable.
This commit is contained in:
parent
6f1b4292f0
commit
6585e18571
|
@ -148,10 +148,12 @@ adts_song_duration(DecoderBuffer *buffer)
|
|||
decoder_buffer_consume(buffer, frame_length);
|
||||
}
|
||||
|
||||
float frames_per_second = (float)sample_rate / 1024.0;
|
||||
if (frames_per_second <= 0)
|
||||
if (sample_rate == 0)
|
||||
return -1;
|
||||
|
||||
float frames_per_second = (float)sample_rate / 1024.0;
|
||||
assert(frames_per_second > 0);
|
||||
|
||||
return (float)frames / frames_per_second;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue