From 76d113c01c9d97a43c361252fef65ba4b1e4da6c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 28 Aug 2021 20:29:06 +0200 Subject: [PATCH] mp4: Simplify mp4_num_samples(). We don't need to iterate over the entries of the stts_sample_count array because the number stored in the stsz_sample_count field should be identical to the sum of the sample counts. --- mp4.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/mp4.c b/mp4.c index 9e33eb4c..381c9a21 100644 --- a/mp4.c +++ b/mp4.c @@ -722,12 +722,7 @@ uint16_t mp4_get_channel_count(const struct mp4 *f) uint32_t mp4_num_samples(const struct mp4 *f) { - const struct mp4_track *t = &f->track; - uint32_t total = 0; - - for (uint32_t n = 0; n < t->stts_entry_count; n++) - total += t->stts_sample_count[n]; - return total; + return f->track.stsz_sample_count; } int mp4_open_meta(const struct mp4_callback *cb, struct mp4 **result) -- 2.39.5