[GStreamer][EME] Not having a key id buffer should not always error
authorcalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2017 10:39:21 +0000 (10:39 +0000)
committercalvaris@igalia.com <calvaris@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 27 Jul 2017 10:39:21 +0000 (10:39 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174889

Reviewed by Žan Doberšek.

In r219946 we introduced a hard requirement for a key id buffer
that does not happen for all CDMs.

* platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
(webKitMediaClearKeyDecryptorSetupCipher): Check for key id buffer
and error if we didn't get it.
* platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
(webkitMediaCommonEncryptionDecryptTransformInPlace): Soften the
requirement for key id buffer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219980 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp
Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp

index db07cfd..5a00044 100644 (file)
@@ -1,5 +1,22 @@
 2017-07-27  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
+        [GStreamer][EME] Not having a key id buffer should not always error
+        https://bugs.webkit.org/show_bug.cgi?id=174889
+
+        Reviewed by Žan Doberšek.
+
+        In r219946 we introduced a hard requirement for a key id buffer
+        that does not happen for all CDMs.
+
+        * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
+        (webKitMediaClearKeyDecryptorSetupCipher): Check for key id buffer
+        and error if we didn't get it.
+        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
+        (webkitMediaCommonEncryptionDecryptTransformInPlace): Soften the
+        requirement for key id buffer.
+
+2017-07-27  Xabier Rodriguez Calvar  <calvaris@igalia.com>
+
         [GStreamer][EME] Fix phony debug output in player base for supported key system
         https://bugs.webkit.org/show_bug.cgi?id=174888
 
index d17d43b..56543ad 100644 (file)
@@ -158,6 +158,11 @@ static gboolean webKitMediaClearKeyDecryptorHandleKeyResponse(WebKitMediaCommonE
 
 static gboolean webKitMediaClearKeyDecryptorSetupCipher(WebKitMediaCommonEncryptionDecrypt* self, GstBuffer* keyIDBuffer)
 {
+    if (!keyIDBuffer) {
+        GST_ERROR_OBJECT(self, "got no key id buffer");
+        return false;
+    }
+
     WebKitMediaClearKeyDecryptPrivate* priv = WEBKIT_MEDIA_CK_DECRYPT_GET_PRIVATE(WEBKIT_MEDIA_CK_DECRYPT(self));
     gcry_error_t error;
 
index 7b0da3f..af0bf83 100644 (file)
@@ -254,13 +254,10 @@ static GstFlowReturn webkitMediaCommonEncryptionDecryptTransformInPlace(GstBaseT
     }
 
     value = gst_structure_get_value(protectionMeta->info, "kid");
-    if (!value) {
-        GST_ERROR_OBJECT(self, "Failed to get key ID for sample");
-        gst_buffer_remove_meta(buffer, reinterpret_cast<GstMeta*>(protectionMeta));
-        return GST_FLOW_NOT_SUPPORTED;
-    }
+    GstBuffer* keyIDBuffer = nullptr;
+    if (value)
+        keyIDBuffer = gst_value_get_buffer(value);
 
-    GstBuffer* keyIDBuffer = gst_value_get_buffer(value);
     WebKitMediaCommonEncryptionDecryptClass* klass = WEBKIT_MEDIA_CENC_DECRYPT_GET_CLASS(self);
     if (!klass->setupCipher(self, keyIDBuffer)) {
         GST_ERROR_OBJECT(self, "Failed to configure cipher");