From e4897ce9b79a58a0ccfe5f6fc2b6d4738710f93f Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 20 Aug 2021 13:38:55 +0200 Subject: [PATCH] mp4: Simplify read_mp4a(). The single caller resets the file offset after the call, so we may stop reading the atom after we've parsed the last field of interest, which happens to be the sample rate. --- mp4.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mp4.c b/mp4.c index 2ca4ed8a..479a2b69 100644 --- a/mp4.c +++ b/mp4.c @@ -550,7 +550,6 @@ static int read_mp4a(struct mp4 *f) { int ret; int32_t i; - uint8_t atom_type = 0; struct mp4_track *t; if (f->total_tracks == 0) @@ -583,13 +582,7 @@ static int read_mp4a(struct mp4 *f) ret = read_int16(f, NULL); if (ret <= 0) return ret; - ret = read_int16(f, &t->sampleRate); - if (ret <= 0) - return ret; - ret = read_int16(f, NULL); - if (ret <= 0) - return ret; - return atom_read_header(f, &atom_type, NULL, NULL); + return read_int16(f, &t->sampleRate); } static int read_stsd(struct mp4 *f) -- 2.39.2