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

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

Issue 2114473002: Remove usage of MediaCodec.getName(), use proxy instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.annotation.TargetApi; 7 import android.annotation.TargetApi;
8 import android.media.AudioFormat; 8 import android.media.AudioFormat;
9 import android.media.AudioManager; 9 import android.media.AudioManager;
10 import android.media.AudioTrack; 10 import android.media.AudioTrack;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 219 }
220 220
221 if (info.mediaCodec == null) return null; 221 if (info.mediaCodec == null) return null;
222 222
223 return new MediaCodecBridge(info.mediaCodec, mime, info.supportsAdaptive Playback); 223 return new MediaCodecBridge(info.mediaCodec, mime, info.supportsAdaptive Playback);
224 } 224 }
225 225
226 @CalledByNative 226 @CalledByNative
227 private void release() { 227 private void release() {
228 try { 228 try {
229 Log.w(TAG, "calling MediaCodec.release() on " + mMediaCodec.getName( )); 229 String codecName = "unknown";
230 if (Build.VERSION.SDK_INT >= Build.VERSION.JELLY_BEAN_MR2)
watk 2016/06/30 00:38:20 Needs to be Build.VERSION_CODES.JELLY_BEAN_MR2
DaleCurtis 2016/06/30 00:59:26 Heh, impressed that's the only error given I wrote
231 codecName = mMediaCodec.getName();
232 Log.w(TAG, "calling MediaCodec.release() on " + codecName);
230 mMediaCodec.release(); 233 mMediaCodec.release();
231 } catch (IllegalStateException e) { 234 } catch (IllegalStateException e) {
232 // The MediaCodec is stuck in a wrong state, possibly due to losing 235 // The MediaCodec is stuck in a wrong state, possibly due to losing
233 // the surface. 236 // the surface.
234 Log.e(TAG, "Cannot release media codec", e); 237 Log.e(TAG, "Cannot release media codec", e);
235 } 238 }
236 mMediaCodec = null; 239 mMediaCodec = null;
237 if (mAudioTrack != null) { 240 if (mAudioTrack != null) {
238 mAudioTrack.release(); 241 mAudioTrack.release();
239 } 242 }
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 case 8: 746 case 8:
744 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 747 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
745 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; 748 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
746 } else { 749 } else {
747 return AudioFormat.CHANNEL_OUT_7POINT1; 750 return AudioFormat.CHANNEL_OUT_7POINT1;
748 } 751 }
749 default: 752 default:
750 return AudioFormat.CHANNEL_OUT_DEFAULT; 753 return AudioFormat.CHANNEL_OUT_DEFAULT;
751 } 754 }
752 } 755 }
753
754 /**
755 * Return true if and only if this codec is a software codec.
756 */
757 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
758 @CalledByNative
759 private boolean isSoftwareCodec() {
760 boolean result = false;
761 try {
762 result = MediaCodecUtil.isSoftwareCodec(mMediaCodec.getName());
763 } catch (Exception e) {
764 Log.e(TAG, "Cannot determine software codec", e);
765 }
766 return result;
767 }
768 } 756 }
OLDNEW
« no previous file with comments | « no previous file | media/base/android/media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698