From d2f7777f7a80267af38b29f1301c70fcf04df580 Mon Sep 17 00:00:00 2001 From: "roman.artiukhin" Date: Tue, 5 Sep 2023 00:31:56 +0300 Subject: Codecs: mp4: metadata: Fix time length in very large files Fix 40 hours long book reported as 14 hours due to samples overflow Change-Id: I5988d4492b1f51081fff921180de6fe384ab5f4f --- lib/rbcodec/metadata/mp4.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/rbcodec/metadata/mp4.c') diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c index 19e6b515c7..7686165a0d 100644 --- a/lib/rbcodec/metadata/mp4.c +++ b/lib/rbcodec/metadata/mp4.c @@ -707,13 +707,11 @@ static bool read_mp4_container(int fd, struct mp3entry* id3, * need any further special handling. */ if (id3->codectype==AFMT_MP4_AAC_HE && l<=1024) { - id3->samples += n * l * 2; + l *= 2; id3->needs_upsampling_correction = true; } - else - { - id3->samples += n * l; - } + + id3->samples += (uint64_t) n * l; } size = 0; -- cgit v1.2.3