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

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

Issue 2106133003: [M52] Make AVDA fall back to software decoding if needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 months 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 | media/base/android/java/src/org/chromium/media/MediaCodecUtil.java » ('j') | 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 9a8a519e224eac9da1d503b11c3300135a6ef919..d0ee73e2419618f7028a8f5a848963caf3ee1553 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
@@ -202,7 +202,8 @@ class MediaCodecBridge {
}
@CalledByNative
- private static MediaCodecBridge create(String mime, boolean isSecure, int direction) {
+ private static MediaCodecBridge create(
+ String mime, boolean isSecure, int direction, boolean requireSoftwareCodec) {
MediaCodecUtil.CodecCreationInfo info = new MediaCodecUtil.CodecCreationInfo();
try {
if (direction == MediaCodecUtil.MEDIA_CODEC_ENCODER) {
@@ -210,7 +211,7 @@ class MediaCodecBridge {
info.supportsAdaptivePlayback = false;
} else {
// |isSecure| only applies to video decoders.
- info = MediaCodecUtil.createDecoder(mime, isSecure);
+ info = MediaCodecUtil.createDecoder(mime, isSecure, requireSoftwareCodec);
}
} catch (Exception e) {
Log.e(TAG, "Failed to create MediaCodec: %s, isSecure: %s, direction: %d",
@@ -225,7 +226,7 @@ class MediaCodecBridge {
@CalledByNative
private void release() {
try {
- Log.w(TAG, "calling MediaCodec.release()");
+ Log.w(TAG, "calling MediaCodec.release() on " + mMediaCodec.getName());
mMediaCodec.release();
} catch (IllegalStateException e) {
// The MediaCodec is stuck in a wrong state, possibly due to losing
@@ -749,4 +750,19 @@ class MediaCodecBridge {
return AudioFormat.CHANNEL_OUT_DEFAULT;
}
}
+
+ /**
+ * Return true if and only if this codec is a software codec.
+ */
+ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
+ @CalledByNative
+ private boolean isSoftwareCodec() {
+ boolean result = false;
+ try {
+ result = MediaCodecUtil.isSoftwareCodec(mMediaCodec.getName());
+ } catch (Exception e) {
+ Log.e(TAG, "Cannot determine software codec", e);
+ }
+ return result;
+ }
}
« no previous file with comments | « no previous file | media/base/android/java/src/org/chromium/media/MediaCodecUtil.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698