Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DASH Widevine issue when scheme specific ContentProtection is omitted #3630

Closed
lucalooz opened this issue Dec 22, 2017 · 23 comments
Closed

DASH Widevine issue when scheme specific ContentProtection is omitted #3630

lucalooz opened this issue Dec 22, 2017 · 23 comments
Assignees
Labels

Comments

@lucalooz
Copy link

I have a DASH content protected with Widevine that doesn't work only on ExoPlayer 2.6.0 (it works on 2.5.4).

The manifest for content protection contains only
<ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="fe2cbd2e-78a3-5fdd-b1f7-3b166d8abbed" />

When checking if the video format is supported 2.6.0 returns FORMAT_UNSUPPORTED_DRM.

I have debugged the ExoPlayer source of 2.5.4 and 2.6.0 to find the difference.

On 2.5.4 the previous ContentProtection tag is ignored in DashManifestParser and so drmInitData inside supportsFormat of MediaCodecRenderer is null and it assumes that there is no protection. Only later it will update drmInitData by parsing a Widevine SchemeData from the MP4 atoms and ask for the license.

On 2.6.0 the ContentProtection tag is parsed with a SchemeData having COMMON_PSSH_UUID as uuid. Because there is an existing DrmInitData the MediaVideoCodecRenderer class doesn't assume that there is no protection and checks if it's a supported DRM by calling canAcquireSession of DrmSessionManager. DefaultDrmSessionManager calls getSchemeData that will return null because there is no match with the Widevine UUID or with the CLEARKEY logic, this will finally result in FORMAT_UNSUPPORTED_DRM.

I don't know much about DASH manifest and DRM standards so currently i can't say if it's an ExoPlayer issue or it's a malformed manifest.

Unfortunately i don't have any control on these DASH manifests.

@ojw28 ojw28 self-assigned this Dec 22, 2017
@ojw28
Copy link
Contributor

ojw28 commented Dec 22, 2017

I'm not sure either, although regardless of whether it's required to include the scheme specific ContentProtection elements, it seems highly preferable to do so.

Assigning to myself to figure out whether we should be more lenient in this case.

@ojw28 ojw28 changed the title DASH Widevine DRM issue only on 2.6.0 DASH Widevine issue when scheme specific ContentProtection is omitted Dec 22, 2017
@piatt
Copy link

piatt commented Dec 29, 2017

I am experiencing a similar issue, except my app crashes trying to parse the UUID from the the defaultKid string. I too have no control over the manifests, but it seems that the switch statement in the parseContentProtection method changed from 2.5.4 to 2.6.0, and now does not allow me to proceed for DASH Widevine parsing. Here is a sample of a manifest my app might use:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mas="urn:marlin:mas:1-0:services:schemas:mpd" xmlns:mspr="urn:microsoft:playready" mediaPresentationDuration="PT2H9M27.301S" minBufferTime="PT3.00S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" type="static">
    <!--  Created with Bento4 mp4-dash.py, VERSION=1.6.0-601  -->
    <Period>
        <AdaptationSet lang="English (United States)" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
            <Role schemeIdUri="urn:mpeg:dash:role:2011" value="alternate" />
            <!--  Common Encryption  -->
            <ContentProtection cenc:default_KID="12677be9-4e98-86cd-d05eee34fd5c547f" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />
            <!--  Marlin  -->
            <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
                <mas:MarlinContentIds>
                    <mas:MarlinContentId>urn:marlin:kid:12677be94e9886cdd05eee34fd5c547f</mas:MarlinContentId>
                </mas:MarlinContentIds>
            </ContentProtection>
            <!--  PlayReady  -->
            <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
                <mspr:pro>egIAAAEAAQBwAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4ANgBYAHQAbgBFAHAAaABPAHoAWQBiAFEAWAB1ADQAMAAvAFYAeABVAGYAdwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBFAFAAbABWAG0AOQBWAFkAZABWAGcAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBwAHIALgBzAHcAYQBuAGsAbQBwAC4AYwBvAG0ALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</mspr:pro>
            </ContentProtection>
            <!--  Widevine  -->
            <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
                <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0IARIQEmd76U6Yhs3QXu40/VxUfxoFc3dhbmsiIDEyNjc3QkU5NEU5ODg2Q0REMDVFRUUzNEZENUM1NDdG</cenc:pssh>
            </ContentProtection>
            <!--  Primetime  -->
            <ContentProtection schemeIdUri="urn:uuid:F239E769-EFA3-4850-9C16-A903C6932EFB" />
            <Representation audioSamplingRate="48000" bandwidth="221502" codecs="mp4a.40.2" id="audio-en-US">
                <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2" />
                <BaseURL>A56627_E2_XX_XX_XX_en-US.mp4</BaseURL>
                <SegmentBase indexRange="1467-32578">
                    <Initialization range="0-1466" />
                </SegmentBase>
            </Representation>
        </AdaptationSet>
        <AdaptationSet mimeType="video/mp4" segmentAlignment="true" startWithSAP="1">
            <!--  Common Encryption  -->
            <ContentProtection cenc:default_KID="12677be9-4e98-86cd-d05eee34fd5c547f" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" />
            <!--  Marlin  -->
            <ContentProtection schemeIdUri="urn:uuid:5E629AF5-38DA-4063-8977-97FFBD9902D4">
                <mas:MarlinContentIds>
                    <mas:MarlinContentId>urn:marlin:kid:12677be94e9886cdd05eee34fd5c547f</mas:MarlinContentId>
                </mas:MarlinContentIds>
            </ContentProtection>
            <!--  PlayReady  -->
            <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
                <mspr:pro>egIAAAEAAQBwAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4ANgBYAHQAbgBFAHAAaABPAHoAWQBiAFEAWAB1ADQAMAAvAFYAeABVAGYAdwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBFAFAAbABWAG0AOQBWAFkAZABWAGcAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAcwA6AC8ALwBwAHIALgBzAHcAYQBuAGsAbQBwAC4AYwBvAG0ALwByAGkAZwBoAHQAcwBtAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</mspr:pro>
            </ContentProtection>
            <!--  Widevine  -->
            <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
                <cenc:pssh>AAAAXXBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAD0IARIQEmd76U6Yhs3QXu40/VxUfxoFc3dhbmsiIDEyNjc3QkU5NEU5ODg2Q0REMDVFRUUzNEZENUM1NDdG</cenc:pssh>
            </ContentProtection>
            <!--  Primetime  -->
            <ContentProtection schemeIdUri="urn:uuid:F239E769-EFA3-4850-9C16-A903C6932EFB" />
            <Representation bandwidth="1212093" codecs="avc1.4D401F" frameRate="24000/1001" height="720" id="video-1" scanType="progressive" width="1280">
                <BaseURL>A56627_E2_XX_XX_XX_720p_1200kbps_en-US.mp4</BaseURL>
                <SegmentBase indexRange="1539-9334">
                    <Initialization range="0-1538" />
                </SegmentBase>
            </Representation>
            <Representation bandwidth="1511461" codecs="avc1.4D401F" frameRate="24000/1001" height="480" id="video-2" scanType="progressive" width="854">
                <BaseURL>A56627_E2_XX_XX_XX_480p_1500kbps_en-US.mp4</BaseURL>
                <SegmentBase indexRange="1539-9334">
                    <Initialization range="0-1538" />
                </SegmentBase>
            </Representation>
        </AdaptationSet>
    </Period>
</MPD>

And here is the exception:

java.lang.IllegalArgumentException: Invalid UUID: 12677be9-4e98-86cd-d05eee34fd5c547f
	at java.util.UUID.fromString(UUID.java:198)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parseContentProtection(DashManifestParser.java:360)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parseAdaptationSet(DashManifestParser.java:258)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parsePeriod(DashManifestParser.java:209)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parseMediaPresentationDescription(DashManifestParser.java:137)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:99)
	at com.google.android.exoplayer2.source.dash.manifest.DashManifestParser.parse(DashManifestParser.java:54)

Clearly that string is not a valid UUID, hence the crash, but the format of the manifest has not changed, which leads me to wonder why the change from 2.5.4 to 2.6.0 was made that would break this step in the parsing process. I would love to be able to take advantage of the improvements made in 2.6.0, but cannot until this is resolved. Thanks!

@ojw28
Copy link
Contributor

ojw28 commented Jan 2, 2018

Does your app really crash (i.e. the process actually dies because the exception is uncaught), or is it just that playback fails? If your app really crashes, please provide the complete stack trace (i.e. there must be more call stack calling into DashManifestParser.parse). Thanks.

@piatt
Copy link

piatt commented Jan 2, 2018

My application does not crash, since I catch the exception, but the exception is received via the onPlayerError listener method, as a ExoPlaybackException, with the cause of the error being the UUID stacktrace above.

@ojw28
Copy link
Contributor

ojw28 commented Jan 3, 2018

@piatt - I took a look at your example. The manifest is not spec compliant, and unfortunately failure is expected in this case. We have no plan to mitigate the issue unless it turns out to be a widespread problem, so I suggest you contact whoever's content you're attempting to play and ask them to fix it. The reason it fails now when it didn't previously is that we're parsing more elements from the manifest, which was required to fix #3138. If you require a workaround for the issue then you can extend DashManifestParser, override parseContentProtection with an implementation that's robust against this particular manifest issue, and inject an instance of your custom parser when you build the DashMediaSource.

@piatt
Copy link

piatt commented Jan 3, 2018

@ojw28 thanks for letting me know. I can try your workaround in the interim, but could you provide a couple of technical specifics or point me to spec reqs that I could bring to the manifest vendor as items that would need to change? Any help would be much appreciated!

@ojw28
Copy link
Contributor

ojw28 commented Jan 3, 2018

The only thing wrong with the manifest is that the UUID we're failing to parse is missing a dash where there should be one. It's in the manifest as:

12677be9-4e98-86cd-d05eee34fd5c547f

But it should be:

12677be9-4e98-86cd-d05e-ee34fd5c547f

See: https://en.wikipedia.org/wiki/Universally_unique_identifier

@ojw28
Copy link
Contributor

ojw28 commented Jan 3, 2018

@llooz - I think our plan is to optimistically attempt playback of media in the case you describe (printing a warning to logcat). Playback will then fail a bit later in the initialization process if scheme specific DRM init data for the correct scheme (Widevine) isn't present in the streams themselves.

@letianxu
Copy link

letianxu commented Jan 3, 2018

@ojw28 We have experienced the same issue here: in 2.5.4 parsing content protection is omitted, so when using DashUtil.loadDrmInitData, it goes to DashUtil.loadSampleFormat to get drmInitData; while in 2.6.0 it parses content protection, but drmInitData.data is null, which will causes DefaultDrmSessionManager.acquireSession failure.

@piatt
Copy link

piatt commented Jan 3, 2018

@ojw28 thank you for you help!

@sebastien4
Copy link

sebastien4 commented Jan 4, 2018

@ojw28 Same problem here, looks like @llooz one. Here is mpd which fails:

<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500000S" type="static" mediaPresentationDuration="PT0H27M15.20S" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" xmlns:cenc="urn:mpeg:cenc:2013">
 <ProgramInformation>
  <Title>ROOM1040105W0123688</Title>
 </ProgramInformation>

 <Period duration="PT0H27M15.20S">
  <AdaptationSet segmentAlignment="true" maxWidth="1920" maxHeight="1080" maxFrameRate="25" subsegmentStartsWithSAP="1">
   <Representation id="1" mimeType="video/mp4" codecs="avc1.640015" width="426" height="240" frameRate="25" sar="640:639" startWithSAP="1" bandwidth="175397">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.230k.240p.230k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1733-7008">
      <Initialization range="0-1732"/>
    </SegmentBase>
   </Representation>
   <Representation id="2" mimeType="video/mp4" codecs="avc1.640015" width="482" height="272" frameRate="25" sar="2176:2169" startWithSAP="1" bandwidth="500335">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.550k.272p.550k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1733-7008">
      <Initialization range="0-1732"/>
    </SegmentBase>
   </Representation>
   <Representation id="3" mimeType="video/mp4" codecs="avc1.64001e" width="654" height="368" frameRate="25" sar="2944:2943" startWithSAP="1" bandwidth="1001223">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.1000k.368p.1000k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1733-7008">
      <Initialization range="0-1732"/>
    </SegmentBase>
   </Representation>
   <Representation id="4" mimeType="video/mp4" codecs="avc1.64001e" width="852" height="480" frameRate="25" sar="640:639" startWithSAP="1" bandwidth="1600470">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.1600k.480p.1600k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1733-7008">
      <Initialization range="0-1732"/>
    </SegmentBase>
   </Representation>
   <Representation id="5" mimeType="video/mp4" codecs="avc1.64001f" width="1024" height="576" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="2100393">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.2100k.576p.2100k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1713-6988">
      <Initialization range="0-1712"/>
    </SegmentBase>
   </Representation>
   <Representation id="6" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="2599224">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.2600k.720p.2600k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1713-6988">
      <Initialization range="0-1712"/>
    </SegmentBase>
   </Representation>
   <Representation id="7" mimeType="video/mp4" codecs="avc1.64001f" width="1280" height="720" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="2998760">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.3000k.720p.3000k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1713-6988">
      <Initialization range="0-1712"/>
    </SegmentBase>
   </Representation>
   <Representation id="8" mimeType="video/mp4" codecs="avc1.640028" width="1920" height="1080" frameRate="25" sar="1:1" startWithSAP="1" bandwidth="4995416">
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t0.5000k.1080p.5000k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1714-6989">
      <Initialization range="0-1713"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" group="1" lang="fra" subsegmentStartsWithSAP="1">
   <Representation id="9" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="44100" startWithSAP="1" bandwidth="100945">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t1.p0.96k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1640-11499">
      <Initialization range="0-1639"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" group="1" lang="eng" subsegmentStartsWithSAP="1">
   <Representation id="10" mimeType="audio/mp4" codecs="mp4a.40.2" audioSamplingRate="44100" startWithSAP="1" bandwidth="100945">
    <AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
    <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="ade6210d-7e1d-4c55-a70e-4e8b6d28caab"/>
    <BaseURL>ROOM1040105W0123688.t2.p0.96k.4B3BC829-A3E1-40B1-B3F1-6C3C2B65CF9E.packaged_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="1639-11498">
      <Initialization range="0-1638"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
  <AdaptationSet segmentAlignment="true" lang="fra" subsegmentStartsWithSAP="1">
   <Representation id="11" mimeType="application/mp4" codecs="stpp" startWithSAP="1" bandwidth="1492">
    <BaseURL>ROOM1040105W0123688.t4.dash_dashinit.mp4</BaseURL>
    <SegmentBase indexRangeExact="true" indexRange="632-6267">
      <Initialization range="0-631"/>
    </SegmentBase>
   </Representation>
  </AdaptationSet>
 </Period>
</MPD>

ojw28 added a commit that referenced this issue Jan 4, 2018
- Parse multiple kids from default_KID. It's specified as a whitespace
  separated list of UUIDs rather than a single UUID.
- Opportunistically proceed with playback in cases where the manifest
  only defines a single SchemeData with the common PSSH UUID. In such
  cases the manifest isn't saying anything about which specific DRM
  schemes it supports.

Issue: #3630

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180675056
ojw28 added a commit that referenced this issue Jan 4, 2018
DASH manifests can now contain non-null but incomplete
DRM init data. Hence using the manifest init data when
non-null is not always the correct thing to do. This
change merges the sample and manifest formats (which
correctly merges the DRM init data) and then uses the
result.

Issue: #3630

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=180787784
@ojw28
Copy link
Contributor

ojw28 commented Jan 4, 2018

The issue should be fixed on the latest dev-v2 branch. If someone could verify, that would be great. We may consider doing a 2.6.2 release to pick up the changes referenced above once verified.

@letianxu
Copy link

letianxu commented Jan 4, 2018

I verified a1bac99, it's working for me. Thanks.

@ojw28
Copy link
Contributor

ojw28 commented Jan 5, 2018

@llooz - Is it possible for you to verify also? The issue @letianxu verified is related, but different. Thanks!

@lucalooz
Copy link
Author

lucalooz commented Jan 5, 2018

@ojw28 with the latest dev commit a1bac99f3bae78e510e367b61dd49a37e4301476 I'm getting the exception at the bottom.
After inspecting the code i see that Format#copyWithManifestFormatInfo gives priority to the manifest DrmInitData

01-05 16:18:29.617 18788-18788/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [1139.73]
                                                                                 com.google.android.exoplayer2.ExoPlaybackException
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:341)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:854)
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:551)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:570)
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:316)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98)
                                                                                     at android.os.Looper.loop(Looper.java:148)
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61)
                                                                                  Caused by: com.google.android.exoplayer2.drm.DrmSession$DrmSessionException: java.lang.IllegalStateException: Media does not support uuid: edef8ba9-79d6-4ace-a3c8-27dcd51d21ed
                                                                                     at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.acquireSession(DefaultDrmSessionManager.java:403)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:830)
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455) 
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:551) 
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:570) 
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:316) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61) 
                                                                                  Caused by: java.lang.IllegalStateException: Media does not support uuid: edef8ba9-79d6-4ace-a3c8-27dcd51d21ed
                                                                                     at com.google.android.exoplayer2.drm.DefaultDrmSessionManager.acquireSession(DefaultDrmSessionManager.java:393)
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:830) 
                                                                                     at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455) 
                                                                                     at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:551) 
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:570) 
                                                                                     at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:316) 
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:98) 
                                                                                     at android.os.Looper.loop(Looper.java:148) 
                                                                                     at android.os.HandlerThread.run(HandlerThread.java:61) ```

@ojw28
Copy link
Contributor

ojw28 commented Jan 5, 2018

Right, that's probably still a problem. Are you able to share a sample piece of media? It would help us to fix this more efficiently.

@cyrillrx
Copy link

cyrillrx commented Jan 5, 2018

@ojw28 same problem as @llooz with the commit a1bac99
StackTrace and mpd attached (I renamed the mpd with .txt as the .mpd extension is not supported by github)
exo-drm-stack-trace.log
24da2a1dd981804c6b758d18d705d07dac02798a.mpd.txt

@ojw28
Copy link
Contributor

ojw28 commented Jan 8, 2018

@llooz - I'm not sure I understand that manifest, regardless of this issue. It appears to indicate that the audio streams are not DRM protected at all, when in fact they are.

@ojw28
Copy link
Contributor

ojw28 commented Jan 8, 2018

Ignore me, the audio streams appear to not be DRM protected after all.

@ojw28
Copy link
Contributor

ojw28 commented Jan 8, 2018

@AquilesCanta - Current status of this issue is approximately:

  • Problematic content defines a COMMON_PSSH_UUID ContentProtection element (only) in the manifest. It may or may not have data. Widevine specific data arrives in the media streams.
  • DefaultDrmSessionManager.canAcquireSession decides the DRM scheme isn't supported. Also, when the manifest and media stream DRM data gets merged, we don't merge the Widevine specific data if the COMMON_PSSH_UUID ContentProtection element has data, because Format.getFilledManifestDrmData deems the manifest DRM data as being complete in this case.

I'm not sure we can avoid having a special case for the manifest containing only a COMMON_PSSH_UUID ContentProtection element. I'd rather we didn't special case in two different places though. I was wondering whether we should:

  1. Move Format.getFilledManifestDrmData into DrmInitData.copyWithSampleDrmInitData (to be called on the manifest instance). Add the special case there that allows merging of extra data from the media stream.
  2. In DefaultDrmSessionManager.canAcquireSession, where we currently return false, instead construct a dummy media stream DrmInitData containing scheme specific data for our own UUID. Try and merge it into drmInitData. If successful, assume media stream init data will arrive that will let us acquire the session rather than saying the scheme isn't supported (probably printing a warning to show we made this assumption).
  3. Not strictly required, but makes everything clearer: We might need DrmInitData to contain a flag indicating whether it's from the manifest only. We could then assert the flag in DrmInitData.copyWithSampleDrmInitData for sanity, and also only try the dummy merge in DefaultDrmSessionManager.canAcquireSession if the flag is set.

There might be a simpler or completely different way. WDYT?

@ojw28 ojw28 assigned AquilesCanta and unassigned ojw28 Jan 8, 2018
@ojw28 ojw28 added the bug label Jan 8, 2018
ojw28 added a commit that referenced this issue Jan 15, 2018
----------------------------------
Original change description:

DRM fixes

- Parse multiple kids from default_KID. It's specified as a whitespace
  separated list of UUIDs rather than a single UUID.
- Opportunistically proceed with playback in cases where the manifest
  only defines a single SchemeData with the common PSSH UUID. In such
  cases the manifest isn't saying anything about which specific DRM
  schemes it supports.

Issue: #3630

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=181137621
@ojw28
Copy link
Contributor

ojw28 commented Jan 24, 2018

Another attempt to fix this is 8716c0e, now in dev-v2. Please verify if you have a chance, thanks!

@cyrillrx
Copy link

cyrillrx commented Feb 15, 2018

I tested on last commit in dev-v2 (f432b52).
It works for me!

@ojw28 ojw28 closed this as completed Feb 16, 2018
@google google locked and limited conversation to collaborators Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants