| OLD | NEW |
| 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } catch (IllegalStateException e) { | 403 } catch (IllegalStateException e) { |
| 404 Log.e(TAG, "Failed to dequeue output buffer", e); | 404 Log.e(TAG, "Failed to dequeue output buffer", e); |
| 405 } | 405 } |
| 406 | 406 |
| 407 return new DequeueOutputResult( | 407 return new DequeueOutputResult( |
| 408 status, index, info.flags, info.offset, info.presentationTimeUs,
info.size); | 408 status, index, info.flags, info.offset, info.presentationTimeUs,
info.size); |
| 409 } | 409 } |
| 410 | 410 |
| 411 @CalledByNative | 411 @CalledByNative |
| 412 private boolean configureVideo(MediaFormat format, Surface surface, MediaCry
pto crypto, | 412 private boolean configureVideo(MediaFormat format, Surface surface, MediaCry
pto crypto, |
| 413 int flags) { | 413 int flags, boolean allowAdaptivePlayback) { |
| 414 try { | 414 try { |
| 415 if (mAdaptivePlaybackSupported) { | 415 if (mAdaptivePlaybackSupported && allowAdaptivePlayback) { |
| 416 format.setInteger(MediaFormat.KEY_MAX_WIDTH, MAX_ADAPTIVE_PLAYBA
CK_WIDTH); | 416 format.setInteger(MediaFormat.KEY_MAX_WIDTH, MAX_ADAPTIVE_PLAYBA
CK_WIDTH); |
| 417 format.setInteger(MediaFormat.KEY_MAX_HEIGHT, MAX_ADAPTIVE_PLAYB
ACK_HEIGHT); | 417 format.setInteger(MediaFormat.KEY_MAX_HEIGHT, MAX_ADAPTIVE_PLAYB
ACK_HEIGHT); |
| 418 } | 418 } |
| 419 mMediaCodec.configure(format, surface, crypto, flags); | 419 mMediaCodec.configure(format, surface, crypto, flags); |
| 420 return true; | 420 return true; |
| 421 } catch (IllegalArgumentException e) { | 421 } catch (IllegalArgumentException e) { |
| 422 Log.e(TAG, "Cannot configure the video codec, wrong format or surfac
e", e); | 422 Log.e(TAG, "Cannot configure the video codec, wrong format or surfac
e", e); |
| 423 } catch (IllegalStateException e) { | 423 } catch (IllegalStateException e) { |
| 424 Log.e(TAG, "Cannot configure the video codec", e); | 424 Log.e(TAG, "Cannot configure the video codec", e); |
| 425 } catch (MediaCodec.CryptoException e) { | 425 } catch (MediaCodec.CryptoException e) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | 608 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
| 609 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; | 609 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; |
| 610 } else { | 610 } else { |
| 611 return AudioFormat.CHANNEL_OUT_7POINT1; | 611 return AudioFormat.CHANNEL_OUT_7POINT1; |
| 612 } | 612 } |
| 613 default: | 613 default: |
| 614 return AudioFormat.CHANNEL_OUT_DEFAULT; | 614 return AudioFormat.CHANNEL_OUT_DEFAULT; |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 } | 617 } |
| OLD | NEW |