mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
parent
3360f5eda5
commit
4527539efe
2 changed files with 25 additions and 4 deletions
|
|
@ -419,7 +419,9 @@ public class DashChunkSource implements ChunkSource {
|
|||
(ChunkIndex) initializationChunk.getSeekMap(),
|
||||
initializationChunk.dataSpec.uri.toString());
|
||||
}
|
||||
if (initializationChunk.hasDrmInitData()) {
|
||||
// The null check avoids overwriting drmInitData obtained from the manifest with drmInitData
|
||||
// obtained from the stream, as per DASH IF Interoperability Recommendations V3.0, 7.5.3.
|
||||
if (drmInitData == null && initializationChunk.hasDrmInitData()) {
|
||||
drmInitData = initializationChunk.getDrmInitData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,12 @@ import com.google.android.exoplayer.dash.mpd.SegmentBase.SingleSegmentBase;
|
|||
import com.google.android.exoplayer.upstream.UriLoadable;
|
||||
import com.google.android.exoplayer.util.Assertions;
|
||||
import com.google.android.exoplayer.util.MimeTypes;
|
||||
import com.google.android.exoplayer.util.ParsableByteArray;
|
||||
import com.google.android.exoplayer.util.UriUtil;
|
||||
import com.google.android.exoplayer.util.Util;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Base64;
|
||||
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
|
@ -41,6 +43,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -270,11 +273,27 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
|
|||
protected ContentProtection parseContentProtection(XmlPullParser xpp)
|
||||
throws XmlPullParserException, IOException {
|
||||
String schemeIdUri = xpp.getAttributeValue(null, "schemeIdUri");
|
||||
return buildContentProtection(schemeIdUri);
|
||||
UUID uuid = null;
|
||||
byte[] data = null;
|
||||
do {
|
||||
xpp.next();
|
||||
// The cenc:pssh element is defined in 23001-7:2015
|
||||
if (isStartTag(xpp, "cenc:pssh") && xpp.next() == XmlPullParser.TEXT) {
|
||||
byte[] decodedData = Base64.decode(xpp.getText(), Base64.DEFAULT);
|
||||
ParsableByteArray psshAtom = new ParsableByteArray(decodedData);
|
||||
psshAtom.skipBytes(12);
|
||||
uuid = new UUID(psshAtom.readLong(), psshAtom.readLong());
|
||||
int dataSize = psshAtom.readInt();
|
||||
data = new byte[dataSize];
|
||||
psshAtom.readBytes(data, 0, dataSize);
|
||||
}
|
||||
} while (!isEndTag(xpp, "ContentProtection"));
|
||||
|
||||
return buildContentProtection(schemeIdUri, uuid, data);
|
||||
}
|
||||
|
||||
protected ContentProtection buildContentProtection(String schemeIdUri) {
|
||||
return new ContentProtection(schemeIdUri, null, null);
|
||||
protected ContentProtection buildContentProtection(String schemeIdUri, UUID uuid, byte[] data) {
|
||||
return new ContentProtection(schemeIdUri, uuid, data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue