Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1195)

Unified Diff: media/base/android/java/src/org/chromium/media/MediaCodecUtil.java

Issue 2058113002: Add 'cbcs' encryption scheme support in Android media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ }
+ }
}
« no previous file with comments | « media/base/android/java/src/org/chromium/media/MediaCodecBridge.java ('k') | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698