mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
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
This commit is contained in:
parent
790e27d929
commit
d8ea770e9b
2 changed files with 10 additions and 1 deletions
|
|
@ -20,6 +20,9 @@ Release notes
|
|||
for seeking.
|
||||
* Use theme when loading drawables on API 21+
|
||||
([#220](https://github.com/androidx/media/issues/220)).
|
||||
* Throw a ParserException instead of a NullPointerException if the sample
|
||||
* table (stbl) is missing a required sample description (stsd) when
|
||||
* parsing trak atoms.
|
||||
* Audio:
|
||||
* Use the compressed audio format bitrate to calculate the min buffer size
|
||||
for `AudioTrack` in direct playbacks (passthrough).
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ import androidx.media3.extractor.GaplessInfoHolder;
|
|||
import androidx.media3.extractor.HevcConfig;
|
||||
import androidx.media3.extractor.OpusUtil;
|
||||
import androidx.media3.extractor.metadata.mp4.SmtaMetadataEntry;
|
||||
import androidx.media3.extractor.mp4.Atom.LeafAtom;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.primitives.Ints;
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue