fixed calculation of encoded audio duration

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6518 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
beveloper
2004-02-07 12:12:43 +00:00
parent 02d71913c4
commit b6fed4cfc9
@@ -152,7 +152,10 @@ aviReader::AllocateCookie(int32 streamNumber, void **_cookie)
TRACE("frame_count %Ld (using fallback)\n", cookie->frame_count);
}
if (stream_header->rate) {
if (stream_header->rate && stream_header->scale) {
cookie->duration = (1000000LL * (int64)stream_header->length * (int64)stream_header->scale) / stream_header->rate;
TRACE("duration %.6f (%Ld) (using scale & rate)\n", cookie->duration / 1E6, cookie->duration);
} else if (stream_header->rate) {
cookie->duration = (1000000LL * (int64)stream_header->length) / stream_header->rate;
TRACE("duration %.6f (%Ld) (using rate)\n", cookie->duration / 1E6, cookie->duration);
} else {