mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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.
|
for seeking.
|
||||||
* Use theme when loading drawables on API 21+
|
* Use theme when loading drawables on API 21+
|
||||||
([#220](https://github.com/androidx/media/issues/220)).
|
([#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:
|
* Audio:
|
||||||
* Use the compressed audio format bitrate to calculate the min buffer size
|
* Use the compressed audio format bitrate to calculate the min buffer size
|
||||||
for `AudioTrack` in direct playbacks (passthrough).
|
for `AudioTrack` in direct playbacks (passthrough).
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import androidx.media3.extractor.GaplessInfoHolder;
|
||||||
import androidx.media3.extractor.HevcConfig;
|
import androidx.media3.extractor.HevcConfig;
|
||||||
import androidx.media3.extractor.OpusUtil;
|
import androidx.media3.extractor.OpusUtil;
|
||||||
import androidx.media3.extractor.metadata.mp4.SmtaMetadataEntry;
|
import androidx.media3.extractor.metadata.mp4.SmtaMetadataEntry;
|
||||||
|
import androidx.media3.extractor.mp4.Atom.LeafAtom;
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.primitives.Ints;
|
import com.google.common.primitives.Ints;
|
||||||
|
|
@ -308,9 +309,14 @@ import org.checkerframework.checker.nullness.compatqual.NullableType;
|
||||||
|
|
||||||
Pair<Long, String> mdhdData =
|
Pair<Long, String> mdhdData =
|
||||||
parseMdhd(checkNotNull(mdia.getLeafAtomOfType(Atom.TYPE_mdhd)).data);
|
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 =
|
StsdData stsdData =
|
||||||
parseStsd(
|
parseStsd(
|
||||||
checkNotNull(stbl.getLeafAtomOfType(Atom.TYPE_stsd)).data,
|
stsd.data,
|
||||||
tkhdData.id,
|
tkhdData.id,
|
||||||
tkhdData.rotationDegrees,
|
tkhdData.rotationDegrees,
|
||||||
mdhdData.second,
|
mdhdData.second,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue