From 6663ff04ae902bdea92b35b3b8dbdccd459d9099 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 18 Aug 2021 20:46:52 +0200 Subject: [PATCH] mp4: Simplify sample_range_size(). Reduce indentation by making the else branch unconditional and simply call the track pointer "t" rather than "p_track". --- mp4.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/mp4.c b/mp4.c index 1b387534..89d90c73 100644 --- a/mp4.c +++ b/mp4.c @@ -1046,19 +1046,14 @@ static int32_t sample_range_size(const struct mp4 *f, int32_t track, int32_t chunk_sample, int32_t sample) { int32_t i, total; - const struct mp4_track *p_track = f->track[track]; - - if (p_track->stsz_sample_size) { - return (sample - chunk_sample) * p_track->stsz_sample_size; - } else { - if (sample >= p_track->stsz_sample_count) - return 0; //error - - for (i = chunk_sample, total = 0; i < sample; i++) { - total += p_track->stsz_table[i]; - } - } + const struct mp4_track *t = f->track[track]; + if (t->stsz_sample_size) + return (sample - chunk_sample) * t->stsz_sample_size; + if (sample >= t->stsz_sample_count) + return 0; /* error */ + for (i = chunk_sample, total = 0; i < sample; i++) + total += t->stsz_table[i]; return total; } -- 2.39.5