Bug 1492915 - Stop WebMDemuxer from inspecting partially encrypted packets for keyframe information. r=jya a=pascalc
authorBryce Van Dyk <bvandyk@mozilla.com>
Fri, 21 Sep 2018 15:58:13 +0000
changeset 490158 948c74f2d3df239534abc9255927c6686617b388
parent 490157 600bf0fc57d47abd1e98b79949f1acc3a4bf5328
child 490159 3947b51293f6f3ddd8173b263cee69f7e4850a45
push id9927
push userapavel@mozilla.com
push dateWed, 03 Oct 2018 09:22:30 +0000
treeherdermozilla-beta@3947b51293f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, pascalc
bugs1492915
milestone63.0
Bug 1492915 - Stop WebMDemuxer from inspecting partially encrypted packets for keyframe information. r=jya a=pascalc Differential Revision: https://phabricator.services.mozilla.com/D6415
dom/media/webm/WebMDemuxer.cpp
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -671,21 +671,26 @@ WebMDemuxer::GetNextPacket(TrackInfo::Tr
           "nestegg_packet_additional_data failed to retrieve alpha data r=%d",
           r);
       }
     }
     bool isKeyframe = false;
     if (aType == TrackInfo::kAudioTrack) {
       isKeyframe = true;
     } else if (aType == TrackInfo::kVideoTrack) {
-      if (packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTED) {
+      if (packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_ENCRYPTED ||
+          packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_PARTITIONED) {
         // Packet is encrypted, can't peek, use packet info
         isKeyframe = nestegg_packet_has_keyframe(holder->Packet())
                      == NESTEGG_PACKET_HAS_KEYFRAME_TRUE;
       } else {
+        MOZ_ASSERT(packetEncryption ==
+                       NESTEGG_PACKET_HAS_SIGNAL_BYTE_UNENCRYPTED ||
+                     packetEncryption == NESTEGG_PACKET_HAS_SIGNAL_BYTE_FALSE,
+                   "Unencrypted packet expected");
         auto sample = MakeSpan(data, length);
         auto alphaSample = MakeSpan(alphaData, alphaLength);
 
         switch (mVideoCodec) {
         case NESTEGG_CODEC_VP8:
           isKeyframe = VPXDecoder::IsKeyframe(sample, VPXDecoder::Codec::VP8);
           if (isKeyframe && alphaLength) {
             isKeyframe =