Fix divide by zero error for aac/m4v files < 1 second long (hat tip to arvzb from the forums)
This commit is contained in:
parent
325c86073b
commit
40a62f7722
|
@ -388,7 +388,7 @@ int scan_get_aacinfo(char *filename, MP3FILE *pmp3) {
|
||||||
/* calculate bitrate from song length... Kinda cheesy */
|
/* calculate bitrate from song length... Kinda cheesy */
|
||||||
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
|
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
|
||||||
atom_offset=scan_aac_drilltoatom(fin,"mdat",&atom_length);
|
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);
|
pmp3->bitrate = atom_length / ((pmp3->song_length / 1000) * 128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,7 @@ int scan_get_mp4info(char *filename, MP3FILE *pmp3) {
|
||||||
/* calculate bitrate from song length... Kinda cheesy */
|
/* calculate bitrate from song length... Kinda cheesy */
|
||||||
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
|
DPRINTF(E_DBG,L_SCAN, "Guesstimating bit rate.\n");
|
||||||
atom_offset=scan_aac_drilltoatom(fin,"mdat",&atom_length);
|
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);
|
pmp3->bitrate = atom_length / ((pmp3->song_length / 1000) * 128);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue