mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08: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 (cherry picked from commit d8ea770e9ba6eed0bdce0b359c54a55be0844fd3)
This commit is contained in:
parent
21996be448
commit
4e7ccd7ffd
@ -17,6 +17,9 @@
|
||||
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…
x
Reference in New Issue
Block a user