bitrate for AAC files falls back to estimation

Apparently, info.bitrate can be zero for AAC files when the information is not
available in the header. MediaFile now falls back to estimation when this is
true.
This commit is contained in:
Adrian Sampson 2012-02-09 12:05:57 -08:00
parent 7522468f0e
commit 72659975a2
2 changed files with 3 additions and 1 deletions

View file

@ -985,7 +985,7 @@ class MediaFile(object):
imprecision is possible because the file header is incorporated
in the file size.
"""
if hasattr(self.mgfile.info, 'bitrate'):
if hasattr(self.mgfile.info, 'bitrate') and self.mgfile.info.bitrate:
# Many formats provide it explicitly.
return self.mgfile.info.bitrate
else:

View file

@ -36,6 +36,8 @@ Changelog
"OR" (upper case).
* Fix an error in the ``rewrite`` and ``inline`` plugins when the corresponding
config sections did not exist.
* Fix bitrate estimation for AAC files whose headers are missing the relevant
data.
1.0b12 (January 16, 2012)
-------------------------