From 761bd091c3368b6d6bdda2cc5e0282efdf3a6500 Mon Sep 17 00:00:00 2001 From: kimvde Date: Tue, 15 Dec 2020 11:23:21 +0000 Subject: [PATCH] Check atom size and recording mode of Samsung saut boxes - In slow motion videos flattened by Samsung, the saut box is kept but only have the 4 first bytes (author field). - In Samsung normal videos, the recording mode is zero. In these cases, skip this box. PiperOrigin-RevId: 347577303 --- .../exoplayer2/extractor/mp4/AtomParsers.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java index 2571df954d..2ff749db75 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java @@ -717,16 +717,15 @@ import org.checkerframework.checker.nullness.compatqual.NullableType; int atomSize = smta.readInt(); int atomType = smta.readInt(); if (atomType == Atom.TYPE_saut) { + if (atomSize < 14) { + return null; + } smta.skipBytes(5); // author (4), reserved = 0 (1). int recordingMode = smta.readUnsignedByte(); - float captureFrameRate; - if (recordingMode == 12) { - captureFrameRate = 240; - } else if (recordingMode == 13) { - captureFrameRate = 120; - } else { - captureFrameRate = C.RATE_UNSET; + if (recordingMode != 12 && recordingMode != 13) { + return null; } + float captureFrameRate = recordingMode == 12 ? 240 : 120; smta.skipBytes(1); // reserved = 1 (1). int svcTemporalLayerCount = smta.readUnsignedByte(); return new Metadata(new SmtaMetadataEntry(captureFrameRate, svcTemporalLayerCount));