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

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

Issue 2572573007: Use passthrough decoder for (E)AC3 formats (Closed)
Patch Set: Fix AudioBuffer 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.media; 5 package org.chromium.media;
6 6
7 import android.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.media.MediaCodec; 8 import android.media.MediaCodec;
9 import android.media.MediaCodec.CryptoInfo; 9 import android.media.MediaCodec.CryptoInfo;
10 import android.media.MediaCodecInfo; 10 import android.media.MediaCodecInfo;
11 import android.media.MediaCodecList; 11 import android.media.MediaCodecList;
12 import android.media.MediaFormat;
12 import android.os.Build; 13 import android.os.Build;
13 14
14 import org.chromium.base.Log; 15 import org.chromium.base.Log;
15 import org.chromium.base.annotations.CalledByNative; 16 import org.chromium.base.annotations.CalledByNative;
16 import org.chromium.base.annotations.JNINamespace; 17 import org.chromium.base.annotations.JNINamespace;
17 import org.chromium.base.annotations.MainDex; 18 import org.chromium.base.annotations.MainDex;
18 19
19 import java.util.Arrays; 20 import java.util.Arrays;
20 import java.util.List; 21 import java.util.List;
21 import java.util.Locale; 22 import java.util.Locale;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 result.supportsAdaptivePlayback = 219 result.supportsAdaptivePlayback =
219 codecSupportsAdaptivePlayback(insecureCodec, mime); 220 codecSupportsAdaptivePlayback(insecureCodec, mime);
220 insecureCodec.release(); 221 insecureCodec.release();
221 } 222 }
222 result.mediaCodec = MediaCodec.createByCodecName(decoderName + " .secure"); 223 result.mediaCodec = MediaCodec.createByCodecName(decoderName + " .secure");
223 } else { 224 } else {
224 if (requireSoftwareCodec) { 225 if (requireSoftwareCodec) {
225 String decoderName = 226 String decoderName =
226 getDefaultCodecName(mime, MEDIA_CODEC_DECODER, requi reSoftwareCodec); 227 getDefaultCodecName(mime, MEDIA_CODEC_DECODER, requi reSoftwareCodec);
227 result.mediaCodec = MediaCodec.createByCodecName(decoderName ); 228 result.mediaCodec = MediaCodec.createByCodecName(decoderName );
229 } else if (mime.equals(MediaFormat.MIMETYPE_AUDIO_RAW)) {
230 result.mediaCodec = MediaCodec.createByCodecName("OMX.google .raw.decoder");
228 } else { 231 } else {
229 result.mediaCodec = MediaCodec.createDecoderByType(mime); 232 result.mediaCodec = MediaCodec.createDecoderByType(mime);
230 } 233 }
231 result.supportsAdaptivePlayback = 234 result.supportsAdaptivePlayback =
232 codecSupportsAdaptivePlayback(result.mediaCodec, mime); 235 codecSupportsAdaptivePlayback(result.mediaCodec, mime);
233 } 236 }
234 } catch (Exception e) { 237 } catch (Exception e) {
235 Log.e(TAG, "Failed to create MediaCodec: %s, isSecure: %s, requireSo ftwareCodec: %s", 238 Log.e(TAG, "Failed to create MediaCodec: %s, isSecure: %s, requireSo ftwareCodec: %s",
236 mime, isSecure, requireSoftwareCodec ? "yes" : "no", e); 239 mime, isSecure, requireSoftwareCodec ? "yes" : "no", e);
237 result.mediaCodec = null; 240 result.mediaCodec = null;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 * supported. 535 * supported.
533 * This method was introduced in Android N. Note that if platformSupportsCbc sEncryption 536 * This method was introduced in Android N. Note that if platformSupportsCbc sEncryption
534 * returns true, then this function will set the pattern. 537 * returns true, then this function will set the pattern.
535 */ 538 */
536 static void setPatternIfSupported(CryptoInfo cryptoInfo, int encrypt, int sk ip) { 539 static void setPatternIfSupported(CryptoInfo cryptoInfo, int encrypt, int sk ip) {
537 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { 540 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
538 cryptoInfo.setPattern(new CryptoInfo.Pattern(encrypt, skip)); 541 cryptoInfo.setPattern(new CryptoInfo.Pattern(encrypt, skip));
539 } 542 }
540 } 543 }
541 } 544 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698