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

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

Issue 605883002: Fix wrong selection of VP8 video decoder on some Samsung devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.media.AudioFormat; 7 import android.media.AudioFormat;
8 import android.media.AudioManager; 8 import android.media.AudioManager;
9 import android.media.AudioTrack; 9 import android.media.AudioTrack;
10 import android.media.MediaCodec; 10 import android.media.MediaCodec;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 private static MediaCodecBridge create(String mime, boolean isSecure, int di rection) { 215 private static MediaCodecBridge create(String mime, boolean isSecure, int di rection) {
216 // Creation of ".secure" codecs sometimes crash instead of throwing exce ptions 216 // Creation of ".secure" codecs sometimes crash instead of throwing exce ptions
217 // on pre-JBMR2 devices. 217 // on pre-JBMR2 devices.
218 if (isSecure && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_M R2) { 218 if (isSecure && Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_M R2) {
219 return null; 219 return null;
220 } 220 }
221 MediaCodec mediaCodec = null; 221 MediaCodec mediaCodec = null;
222 boolean adaptivePlaybackSupported = false; 222 boolean adaptivePlaybackSupported = false;
223 try { 223 try {
224 // |isSecure| only applies to video decoders. 224 // |isSecure| only applies to video decoders.
225 if (mime.startsWith("video") && isSecure && direction == MEDIA_CODEC _DECODER) { 225 if (mime.startsWith("video") && direction == MEDIA_CODEC_DECODER) {
226 String decoderName = getDecoderNameForMime(mime); 226 String decoderName = getDecoderNameForMime(mime);
227 if (decoderName == null) { 227 if (decoderName == null) {
228 return null; 228 return null;
229 } 229 }
230 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 230 if (isSecure) {
231 // To work around an issue that we cannot get the codec info from the secure 231 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
232 // decoder, create an insecure decoder first so that we can query its codec 232 // To work around an issue that we cannot get the code c info from the
233 // info. http://b/15587335. 233 // secure decoder, create an insecure decoder first so that we can query
234 MediaCodec insecureCodec = MediaCodec.createByCodecName(deco derName); 234 // its codec info. http://b/15587335.
235 adaptivePlaybackSupported = codecSupportsAdaptivePlayback(in secureCodec, mime); 235 MediaCodec insecureCodec = MediaCodec.createByCodecNam e(decoderName);
236 insecureCodec.release(); 236 adaptivePlaybackSupported =
237 codecSupportsAdaptivePlayback(insecureCodec, m ime);
238 insecureCodec.release();
239 }
240 mediaCodec = MediaCodec.createByCodecName(decoderName + ".se cure");
241 } else {
242 mediaCodec = MediaCodec.createByCodecName(decoderName);
qinmin 2014/09/26 05:00:28 Are you sure this will not cause any other issues?
AlexGlaznev 2014/09/26 18:01:37 No, I am not 100% sure. But I know, that current w
qinmin 2014/09/26 22:45:55 Can you explain why CreateDecoderByType() will end
243 adaptivePlaybackSupported = codecSupportsAdaptivePlayback(me diaCodec, mime);
237 } 244 }
238 mediaCodec = MediaCodec.createByCodecName(decoderName + ".secure ");
239 } else { 245 } else {
240 if (direction == MEDIA_CODEC_ENCODER) { 246 if (direction == MEDIA_CODEC_ENCODER) {
241 mediaCodec = MediaCodec.createEncoderByType(mime); 247 mediaCodec = MediaCodec.createEncoderByType(mime);
242 } else { 248 } else {
243 mediaCodec = MediaCodec.createDecoderByType(mime); 249 mediaCodec = MediaCodec.createDecoderByType(mime);
244 adaptivePlaybackSupported = codecSupportsAdaptivePlayback(me diaCodec, mime); 250 adaptivePlaybackSupported = codecSupportsAdaptivePlayback(me diaCodec, mime);
245 } 251 }
246 } 252 }
247 } catch (Exception e) { 253 } catch (Exception e) {
248 Log.e(TAG, "Failed to create MediaCodec: " + mime + ", isSecure: " 254 Log.e(TAG, "Failed to create MediaCodec: " + mime + ", isSecure: "
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return AudioFormat.CHANNEL_OUT_QUAD; 647 return AudioFormat.CHANNEL_OUT_QUAD;
642 case 6: 648 case 6:
643 return AudioFormat.CHANNEL_OUT_5POINT1; 649 return AudioFormat.CHANNEL_OUT_5POINT1;
644 case 8: 650 case 8:
645 return AudioFormat.CHANNEL_OUT_7POINT1; 651 return AudioFormat.CHANNEL_OUT_7POINT1;
646 default: 652 default:
647 return AudioFormat.CHANNEL_OUT_DEFAULT; 653 return AudioFormat.CHANNEL_OUT_DEFAULT;
648 } 654 }
649 } 655 }
650 } 656 }
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_codec_bridge.cc » ('j') | media/base/android/media_codec_bridge.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698