From: Andre Noll Date: Sat, 28 Aug 2021 18:29:06 +0000 (+0200) Subject: mp4: Simplify mp4_num_samples(). X-Git-Tag: v0.7.1~7^2~6 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;h=76d113c01c9d97a43c361252fef65ba4b1e4da6c;p=paraslash.git 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. --- 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)