Commit bbe78b10 by Googler Committed by christosts

Throw a ParserException instead of a NullPointerException if the sample table…

Throw a ParserException instead of a NullPointerException if the sample table (stbl) is missing a required sample description (stsd).

As per the javadoc for AtomParsers.parseTrack, ParserException should be "thrown if the trak atom can't be parsed."

PiperOrigin-RevId: 499522748
parent 2a77f1e2
......@@ -32,6 +32,7 @@ import com.google.android.exoplayer2.audio.OpusUtil;
import com.google.android.exoplayer2.drm.DrmInitData;
import com.google.android.exoplayer2.extractor.ExtractorUtil;
import com.google.android.exoplayer2.extractor.GaplessInfoHolder;
import com.google.android.exoplayer2.extractor.mp4.Atom.LeafAtom;
import com.google.android.exoplayer2.metadata.Metadata;
import com.google.android.exoplayer2.metadata.mp4.SmtaMetadataEntry;
import com.google.android.exoplayer2.util.CodecSpecificDataUtil;
......@@ -308,9 +309,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
Pair<Long, String> mdhdData =
parseMdhd(checkNotNull(mdia.getLeafAtomOfType(Atom.TYPE_mdhd)).data);
LeafAtom stsd = stbl.getLeafAtomOfType(Atom.TYPE_stsd);
if (stsd == null) {
throw ParserException.createForMalformedContainer(
"Malformed sample table (stbl) missing sample description (stsd)", /* cause= */ null);
}
StsdData stsdData =
parseStsd(
checkNotNull(stbl.getLeafAtomOfType(Atom.TYPE_stsd)).data,
stsd.data,
tkhdData.id,
tkhdData.rotationDegrees,
mdhdData.second,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment