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

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

Issue 60423004: MediaCodecBridge: don't try to create .secure codecs pre-JB-MR2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added crbug link Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
index 74bec56745e80833f653dc3a06a9b248c24638bf..b240fc4a0713be19b5e830787d6cef20316e8540 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
@@ -12,8 +12,9 @@ import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
import android.media.MediaCrypto;
import android.media.MediaFormat;
-import android.view.Surface;
+import android.os.Build;
import android.util.Log;
+import android.view.Surface;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -151,17 +152,25 @@ class MediaCodecBridge {
continue;
}
- String[] supportedTypes = info.getSupportedTypes();
- String codecString = info.getName();
- String secureCodecName = codecString + ".secure";
boolean secureDecoderSupported = false;
- try {
- MediaCodec secureCodec = MediaCodec.createByCodecName(secureCodecName);
- secureDecoderSupported = true;
- secureCodec.release();
- } catch (Exception e) {
- Log.e(TAG, "Failed to create " + secureCodecName);
+ String codecString = info.getName();
+ // ".secure" codecs sometimes crash instead of throwing on pre-JBMR2
+ // platforms, but this code isn't run on them anyway (MediaDrm
+ // unavailable) so we side-step the issue. http://crbug.com/314868
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
+ String secureCodecName = codecString + ".secure";
+ try {
+ MediaCodec secureCodec = MediaCodec.createByCodecName(secureCodecName);
+ if (secureCodec != null) {
+ secureDecoderSupported = true;
+ secureCodec.release();
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to create " + secureCodecName);
+ }
}
+
+ String[] supportedTypes = info.getSupportedTypes();
for (int j = 0; j < supportedTypes.length; ++j) {
if (!CodecInfoMap.containsKey(supportedTypes[j]) || secureDecoderSupported) {
CodecInfoMap.put(supportedTypes[j], new CodecInfo(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698