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

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

Issue 2461073002: Use MediaCodec.setOutputSurface() for fullscreen transitions on M. (Closed)
Patch Set: Address comments. Created 4 years, 1 month 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/sdk_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.MediaCodec; 9 import android.media.MediaCodec;
10 import android.media.MediaCrypto; 10 import android.media.MediaCrypto;
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 break; 613 break;
614 default: 614 default:
615 name = null; 615 name = null;
616 break; 616 break;
617 } 617 }
618 if (name != null) { 618 if (name != null) {
619 format.setByteBuffer(name, ByteBuffer.wrap(bytes)); 619 format.setByteBuffer(name, ByteBuffer.wrap(bytes));
620 } 620 }
621 } 621 }
622 622
623 @TargetApi(Build.VERSION_CODES.M)
624 @CalledByNative
625 private boolean setSurface(Surface surface) {
626 try {
627 mMediaCodec.setOutputSurface(surface);
628 } catch (IllegalArgumentException | IllegalStateException e) {
629 Log.e(TAG, "Cannot set output surface", e);
630 return false;
631 }
632 return true;
633 }
634
623 @CalledByNative 635 @CalledByNative
624 private static void setFrameHasADTSHeader(MediaFormat format) { 636 private static void setFrameHasADTSHeader(MediaFormat format) {
625 format.setInteger(MediaFormat.KEY_IS_ADTS, 1); 637 format.setInteger(MediaFormat.KEY_IS_ADTS, 1);
626 } 638 }
627 639
628 @CalledByNative 640 @CalledByNative
629 private boolean configureAudio(MediaFormat format, MediaCrypto crypto, int f lags) { 641 private boolean configureAudio(MediaFormat format, MediaCrypto crypto, int f lags) {
630 try { 642 try {
631 mMediaCodec.configure(format, null, crypto, flags); 643 mMediaCodec.configure(format, null, crypto, flags);
632 return true; 644 return true;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { 677 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
666 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; 678 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
667 } else { 679 } else {
668 return AudioFormat.CHANNEL_OUT_7POINT1; 680 return AudioFormat.CHANNEL_OUT_7POINT1;
669 } 681 }
670 default: 682 default:
671 return AudioFormat.CHANNEL_OUT_DEFAULT; 683 return AudioFormat.CHANNEL_OUT_DEFAULT;
672 } 684 }
673 } 685 }
674 } 686 }
OLDNEW
« no previous file with comments | « no previous file | media/base/android/sdk_media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698