mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Add test and formatting changes
This commit is contained in:
parent
521c52fdb9
commit
9ccc4b27ef
@ -181,6 +181,8 @@
|
|||||||
* Fix bug where re-preparing a multi-period live stream can throw an
|
* Fix bug where re-preparing a multi-period live stream can throw an
|
||||||
`IndexOutOfBoundsException`
|
`IndexOutOfBoundsException`
|
||||||
([#1329](https://github.com/androidx/media/issues/1329)).
|
([#1329](https://github.com/androidx/media/issues/1329)).
|
||||||
|
* Add support for `dashif:Laurl` license urls
|
||||||
|
([#1345](https://github.com/androidx/media/issues/1345)).
|
||||||
* Smooth Streaming Extension:
|
* Smooth Streaming Extension:
|
||||||
* RTSP Extension:
|
* RTSP Extension:
|
||||||
* Decoder Extensions (FFmpeg, VP9, AV1, MIDI, etc.):
|
* Decoder Extensions (FFmpeg, VP9, AV1, MIDI, etc.):
|
||||||
|
@ -619,9 +619,9 @@ public class DashManifestParser extends DefaultHandler
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
xpp.next();
|
xpp.next();
|
||||||
if (XmlPullParserUtil.isStartTag(xpp, "clearkey:Laurl") && xpp.next() == XmlPullParser.TEXT) {
|
if ((XmlPullParserUtil.isStartTag(xpp, "clearkey:Laurl")
|
||||||
licenseServerUrl = xpp.getText();
|
|| XmlPullParserUtil.isStartTag(xpp, "dashif:Laurl"))
|
||||||
} else if (XmlPullParserUtil.isStartTag(xpp, "dashif:Laurl") && xpp.next() == XmlPullParser.TEXT) {
|
&& xpp.next() == XmlPullParser.TEXT) {
|
||||||
licenseServerUrl = xpp.getText();
|
licenseServerUrl = xpp.getText();
|
||||||
} else if (XmlPullParserUtil.isStartTag(xpp, "ms:laurl")) {
|
} else if (XmlPullParserUtil.isStartTag(xpp, "ms:laurl")) {
|
||||||
licenseServerUrl = xpp.getAttributeValue(null, "licenseUrl");
|
licenseServerUrl = xpp.getAttributeValue(null, "licenseUrl");
|
||||||
|
@ -83,6 +83,8 @@ public class DashManifestParserTest {
|
|||||||
"media/mpd/sample_mpd_service_description_low_latency_only_target_latency";
|
"media/mpd/sample_mpd_service_description_low_latency_only_target_latency";
|
||||||
private static final String SAMPLE_MPD_CLEAR_KEY_LICENSE_URL =
|
private static final String SAMPLE_MPD_CLEAR_KEY_LICENSE_URL =
|
||||||
"media/mpd/sample_mpd_clear_key_license_url";
|
"media/mpd/sample_mpd_clear_key_license_url";
|
||||||
|
private static final String SAMPLE_MPD_DASHIF_LICENSE_URL =
|
||||||
|
"media/mpd/sample_mpd_dashif_license_url";
|
||||||
|
|
||||||
private static final String NEXT_TAG_NAME = "Next";
|
private static final String NEXT_TAG_NAME = "Next";
|
||||||
private static final String NEXT_TAG = "<" + NEXT_TAG_NAME + "/>";
|
private static final String NEXT_TAG = "<" + NEXT_TAG_NAME + "/>";
|
||||||
@ -951,6 +953,37 @@ public class DashManifestParserTest {
|
|||||||
assertThat(schemeData1.licenseServerUrl).isEqualTo("https://testserver2.test/AcquireLicense");
|
assertThat(schemeData1.licenseServerUrl).isEqualTo("https://testserver2.test/AcquireLicense");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void contentProtection_withDashIfLicenseUrl() throws IOException {
|
||||||
|
DashManifestParser parser = new DashManifestParser();
|
||||||
|
|
||||||
|
DashManifest manifest =
|
||||||
|
parser.parse(
|
||||||
|
Uri.parse("https://example.com/test.mpd"),
|
||||||
|
TestUtil.getInputStream(
|
||||||
|
ApplicationProvider.getApplicationContext(), SAMPLE_MPD_DASHIF_LICENSE_URL));
|
||||||
|
|
||||||
|
assertThat(manifest.getPeriodCount()).isEqualTo(1);
|
||||||
|
Period period = manifest.getPeriod(0);
|
||||||
|
assertThat(period.adaptationSets).hasSize(2);
|
||||||
|
AdaptationSet adaptationSet0 = period.adaptationSets.get(0);
|
||||||
|
AdaptationSet adaptationSet1 = period.adaptationSets.get(1);
|
||||||
|
assertThat(adaptationSet0.representations).hasSize(1);
|
||||||
|
assertThat(adaptationSet1.representations).hasSize(1);
|
||||||
|
Representation representation0 = adaptationSet0.representations.get(0);
|
||||||
|
Representation representation1 = adaptationSet1.representations.get(0);
|
||||||
|
assertThat(representation0.format.drmInitData.schemeType).isEqualTo("cenc");
|
||||||
|
assertThat(representation1.format.drmInitData.schemeType).isEqualTo("cenc");
|
||||||
|
assertThat(representation0.format.drmInitData.schemeDataCount).isEqualTo(2);
|
||||||
|
assertThat(representation1.format.drmInitData.schemeDataCount).isEqualTo(2);
|
||||||
|
DrmInitData.SchemeData schemeData0 = representation0.format.drmInitData.get(0);
|
||||||
|
DrmInitData.SchemeData schemeData1 = representation1.format.drmInitData.get(0);
|
||||||
|
assertThat(schemeData0.uuid).isEqualTo(C.WIDEVINE_UUID);
|
||||||
|
assertThat(schemeData1.uuid).isEqualTo(C.WIDEVINE_UUID);
|
||||||
|
assertThat(schemeData0.licenseServerUrl).isEqualTo("https://testserver1.test/AcquireLicense");
|
||||||
|
assertThat(schemeData1.licenseServerUrl).isEqualTo("https://testserver2.test/AcquireLicense");
|
||||||
|
}
|
||||||
|
|
||||||
private static List<Descriptor> buildCea608AccessibilityDescriptors(String value) {
|
private static List<Descriptor> buildCea608AccessibilityDescriptors(String value) {
|
||||||
return Collections.singletonList(new Descriptor("urn:scte:dash:cc:cea-608:2015", value, null));
|
return Collections.singletonList(new Descriptor("urn:scte:dash:cc:cea-608:2015", value, null));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
Includes ContentProtection elements with additional "dashif:Laurl" license URLs.
|
||||||
|
Covers all possible locations (in AdaptationSet and Representation) and possible order of the
|
||||||
|
licence URL and the cenc value.
|
||||||
|
-->
|
||||||
|
<MPD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:mpeg:DASH:schema:MPD:2011" xsi:schemaLocation="urn:mpeg:DASH:schema:MPD:2011 DASH-MPD.xsd" minBufferTime="PT1.500S" profiles="urn:mpeg:dash:profile:isoff-main:2011" type="static" availabilityStartTime="2016-10-14T17:00:17" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:clearkey="http://dashif.org/guidelines/clearKey">
|
||||||
|
<Period start="PT0.000S" duration="PT0H5M50S">
|
||||||
|
<SegmentTemplate startNumber="0" timescale="1000" media="sq/$Number$">
|
||||||
|
<SegmentTimeline>
|
||||||
|
<S d="2002" t="6009" r="2"/>
|
||||||
|
</SegmentTimeline>
|
||||||
|
</SegmentTemplate>
|
||||||
|
<AdaptationSet id="0" mimeType="audio/mp4" subsegmentAlignment="true">
|
||||||
|
<Representation id="140" codecs="mp4a.40.2" audioSamplingRate="48000" startWithSAP="1" bandwidth="144000">
|
||||||
|
<ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="30303030-3030-3030-3030-303030303030" />
|
||||||
|
<ContentProtection value="Widevine" schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
|
||||||
|
<cenc:pssh>AAAANHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABQIARIQnrQFDeRLSAKTLifXUIPiZg==</cenc:pssh>
|
||||||
|
<dashif:Laurl>https://testserver1.test/AcquireLicense</dashif:Laurl>
|
||||||
|
</ContentProtection>
|
||||||
|
</Representation>
|
||||||
|
</AdaptationSet>
|
||||||
|
<AdaptationSet id="1" mimeType="video/mp4" subsegmentAlignment="true">
|
||||||
|
<ContentProtection value="Widevine" schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
|
||||||
|
<dashif:Laurl>https://testserver2.test/AcquireLicense</dashif:Laurl>
|
||||||
|
<cenc:pssh>AAAANHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABQIARIQnrQFDeRLSAKTLifXUIPiZg==</cenc:pssh>
|
||||||
|
</ContentProtection>
|
||||||
|
<ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="30303030-3030-3030-3030-303030303030" />
|
||||||
|
<Representation id="133" codecs="avc1.4d4015" width="426" height="240" startWithSAP="1" bandwidth="258000" frameRate="30" />
|
||||||
|
</AdaptationSet>
|
||||||
|
</Period>
|
||||||
|
</MPD>
|
Loading…
x
Reference in New Issue
Block a user