Fix divide by zero error for aac/m4v files < 1 second long (hat tip to arvzb from the forums)

This commit is contained in:
Ron Pedde 2006-10-17 03:30:13 +00:00
parent 325c86073b
commit 40a62f7722
2 changed files with 2 additions and 2 deletions

View File

@ -388,7 +388,7 @@ int scan_get_aacinfo(char *filename, MP3FILE *pmp3) {
/* calculate bitrate from song length... Kinda cheesy */
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
atom_offset=scan_aac_drilltoatom(fin,"mdat",&atom_length);
if ((atom_offset != -1) && (pmp3->song_length)) {
if ((atom_offset != -1) && (pmp3->song_length >= 1000)) {
pmp3->bitrate = atom_length / ((pmp3->song_length / 1000) * 128);
}
}

View File

@ -263,7 +263,7 @@ int scan_get_mp4info(char *filename, MP3FILE *pmp3) {
/* calculate bitrate from song length... Kinda cheesy */
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
atom_offset=scan_aac_drilltoatom(fin,"mdat",&atom_length);
if ((atom_offset != -1) && (pmp3->song_length)) {
if ((atom_offset != -1) && (pmp3->song_length > 1000)) {
pmp3->bitrate = atom_length / ((pmp3->song_length / 1000) * 128);
}
}