Index: media/base/android/java/src/org/chromium/media/MediaCodecUtil.java |
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java |
index 5bec0358df14a0903c9919669a491382f8a0bb73..e16cef84e0fe295cce09d9550d52abba96780565 100644 |
--- a/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java |
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecUtil.java |
@@ -6,6 +6,7 @@ package org.chromium.media; |
import android.annotation.TargetApi; |
import android.media.MediaCodec; |
+import android.media.MediaCodec.CryptoInfo; |
import android.media.MediaCodecInfo; |
import android.media.MediaCodecList; |
import android.os.Build; |
@@ -514,4 +515,27 @@ class MediaCodecUtil { |
Log.w(TAG, "HW encoder for " + mime + " is not available on this device."); |
return null; |
} |
+ |
+ /** |
+ * Returns true if and only if the platform we are running on supports the 'cbcs' |
+ * encryption scheme, specifically AES CBC encryption with possibility of pattern |
+ * encryption. |
+ * While 'cbcs' scheme was originally implemented in N, there was a bug (in the |
+ * DRM code) which means that it didn't really work properly until post-N). |
+ */ |
+ static boolean platformSupportsCbcsEncryption() { |
+ return Build.VERSION.SDK_INT > Build.VERSION_CODES.N; |
Torne
2017/05/22 15:44:55
Is this check still correct? Was this bug fixed in
|
+ } |
+ |
+ /** |
+ * Sets the encryption pattern value if and only if CryptoInfo.setPattern method is |
+ * supported. |
+ * This method was introduced in Android N. Note that if platformSupportsCbcsEncryption |
+ * returns true, then this function will set the pattern. |
+ */ |
+ static void setPatternIfSupported(CryptoInfo cryptoInfo, int encrypt, int skip) { |
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { |
+ cryptoInfo.setPattern(new CryptoInfo.Pattern(encrypt, skip)); |
+ } |
+ } |
} |