<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>197417</bug_id>
          
          <creation_ts>2019-04-30 09:22:45 -0700</creation_ts>
          <short_desc>[GStreamer][EME] Encrypted, fragmented MP4s not supported</short_desc>
          <delta_ts>2026-04-01 07:59:05 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>210644</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Charlie Turner">cturner</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>philn</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1531543</commentid>
    <comment_count>0</comment_count>
    <who name="Charlie Turner">cturner</who>
    <bug_when>2019-04-30 09:22:45 -0700</bug_when>
    <thetext>Placeholder bug to record a number of issues affecting encrypted, fragmented MP4s.

There are at least two WPT&apos;s that show this problem,

  clearkey-mp4-playback-temporary-encrypted-clear.https.html
  clearkey-mp4-playback-temporary-clear-encrypted.https.html

And their *-drm equivalents. These are files that contain an encrypted track, followed by a clear one and vice versa respectively.

The current GStreamer behaviour is to try and reconfigure the src pad caps from qtdemux to transition from application/x-cenc -&gt; video/x-h264 and vice versa respectively.
This reconfiguration is not supported by decodebin2, it can&apos;t dynamically change it&apos;s pipeline topology at runtime like that. Decodebin3 should support that, but it at least has bugs dealing with this situation, and we&apos;re not ready to use it in MSE at the moment anyway, so that&apos;s a non-starter.

An attempt was made to modify qtdemux to treat a new fragmented track whose protection status differs from the preceding track as deserving of a new src pad. That works to the extent that decodebin2 will create a second DecodeChain, and autoplug an appropriate pipeline for the new situation, however WK MSE does not allow demuxers to do this for the same SourceBuffer:

connectDemuxerSrcPadToAppsinkFromStreamingThread: Only one stream per SourceBuffer is allowed! Ignoring stream 2 by adding a black hole probe

So we have some options:
  1) Wait until we can turn decodebin3 on always, even in MSE and fix any bugs there blocking this behaviour from working.
  2) Modify qtdemux to expose a new pad (stalled in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/180) and then modify MSE to allow multiple streams per SourceBuffer.
  3) Create a new bin handling video/x-h264 (and friends) *as well as* application/x-cenc with a rank higher than decodebin2. This new bin would essentially wrap decodebin2, and if necessary shove a decryptor in front of the decodebin2 when necessary (and remove it when necessary as fragments change protection status). The large downside here is you&apos;d now have a bin-within-a-bin for every non-encrypted video. Proxypads introduce non-neglible performance hit, and it&apos;s just a pretty gross hack when the above two options would result in a cleaner codebase.


These sorts of files don&apos;t *appear* to be that popular in the wild, so I&apos;m personally happy to wait for either 1 or 2. 3 is an option if an emergency case comes up where this needs implementing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2195908</commentid>
    <comment_count>1</comment_count>
    <who name="Philippe Normand">philn</who>
    <bug_when>2026-04-01 07:59:05 -0700</bug_when>
    <thetext>These are mostly passing for a while now, some occasional flakiness but I guess no one is surprised by that anymore...

https://results.webkit.org/?suite=layout-tests&amp;suite=layout-tests&amp;test=imported%2Fw3c%2Fweb-platform-tests%2Fencrypted-media%2Fclearkey-mp4-playback-temporary-clear-encrypted.https.html&amp;test=imported%2Fw3c%2Fweb-platform-tests%2Fencrypted-media%2Fclearkey-mp4-playback-temporary-encrypted-clear.https.html&amp;platform=GTK&amp;platform=WPE</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>