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

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

Issue 23480036: Support creating secure decoder in MediaCodecBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 assert(mediaCodec != null); 134 assert(mediaCodec != null);
135 mMediaCodec = mediaCodec; 135 mMediaCodec = mediaCodec;
136 mLastPresentationTimeUs = 0; 136 mLastPresentationTimeUs = 0;
137 mFlushed = true; 137 mFlushed = true;
138 } 138 }
139 139
140 @CalledByNative 140 @CalledByNative
141 private static MediaCodecBridge create(String mime, boolean isSecure) { 141 private static MediaCodecBridge create(String mime, boolean isSecure) {
142 MediaCodec mediaCodec = null; 142 MediaCodec mediaCodec = null;
143 try { 143 try {
144 if (isSecure) { 144 // |isSecure| only applies to video decoders.
145 if (mime.startsWith("video") && isSecure) {
145 mediaCodec = MediaCodec.createByCodecName(getSecureDecoderNameFo rMime(mime)); 146 mediaCodec = MediaCodec.createByCodecName(getSecureDecoderNameFo rMime(mime));
146 } else { 147 } else {
147 mediaCodec = MediaCodec.createDecoderByType(mime); 148 mediaCodec = MediaCodec.createDecoderByType(mime);
148 } 149 }
149 } catch (Exception e) { 150 } catch (Exception e) {
150 Log.e(TAG, "Failed to create MediaCodec " + e.toString()); 151 Log.e(TAG, "Failed to create MediaCodec " + e.toString());
151 } 152 }
152 153
153 if (mediaCodec == null) { 154 if (mediaCodec == null) {
154 return null; 155 return null;
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 399 }
399 400
400 private void resetLastPresentationTimeIfNeeded(long presentationTimeUs) { 401 private void resetLastPresentationTimeIfNeeded(long presentationTimeUs) {
401 if (mFlushed) { 402 if (mFlushed) {
402 mLastPresentationTimeUs = 403 mLastPresentationTimeUs =
403 Math.max(presentationTimeUs - MAX_PRESENTATION_TIMESTAMP_SHI FT_US, 0); 404 Math.max(presentationTimeUs - MAX_PRESENTATION_TIMESTAMP_SHI FT_US, 0);
404 mFlushed = false; 405 mFlushed = false;
405 } 406 }
406 } 407 }
407 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698