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.MediaCodec; | 9 import android.media.MediaCodec; |
10 import android.media.MediaCrypto; | 10 import android.media.MediaCrypto; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 // to notify the native code the the frame has a wrong presentat
ion | 449 // to notify the native code the the frame has a wrong presentat
ion |
450 // timestamp and should be skipped. | 450 // timestamp and should be skipped. |
451 info.presentationTimeUs = mLastPresentationTimeUs; | 451 info.presentationTimeUs = mLastPresentationTimeUs; |
452 } | 452 } |
453 mLastPresentationTimeUs = info.presentationTimeUs; | 453 mLastPresentationTimeUs = info.presentationTimeUs; |
454 | 454 |
455 if (indexOrStatus >= 0) { // index! | 455 if (indexOrStatus >= 0) { // index! |
456 status = MEDIA_CODEC_OK; | 456 status = MEDIA_CODEC_OK; |
457 index = indexOrStatus; | 457 index = indexOrStatus; |
458 } else if (indexOrStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED)
{ | 458 } else if (indexOrStatus == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED)
{ |
459 // TODO(crbug.com/665478) | 459 assert Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT; |
460 // assert Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT; | |
461 mOutputBuffers = mMediaCodec.getOutputBuffers(); | 460 mOutputBuffers = mMediaCodec.getOutputBuffers(); |
462 status = MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED; | 461 status = MEDIA_CODEC_OUTPUT_BUFFERS_CHANGED; |
463 } else if (indexOrStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { | 462 } else if (indexOrStatus == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) { |
464 status = MEDIA_CODEC_OUTPUT_FORMAT_CHANGED; | 463 status = MEDIA_CODEC_OUTPUT_FORMAT_CHANGED; |
465 MediaFormat newFormat = mMediaCodec.getOutputFormat(); | 464 MediaFormat newFormat = mMediaCodec.getOutputFormat(); |
466 } else if (indexOrStatus == MediaCodec.INFO_TRY_AGAIN_LATER) { | 465 } else if (indexOrStatus == MediaCodec.INFO_TRY_AGAIN_LATER) { |
467 status = MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER; | 466 status = MEDIA_CODEC_DEQUEUE_OUTPUT_AGAIN_LATER; |
468 } else { | 467 } else { |
469 Log.e(TAG, "Unexpected index_or_status: " + indexOrStatus); | 468 Log.e(TAG, "Unexpected index_or_status: " + indexOrStatus); |
470 assert false; | 469 assert false; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | 677 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { |
679 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; | 678 return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND; |
680 } else { | 679 } else { |
681 return AudioFormat.CHANNEL_OUT_7POINT1; | 680 return AudioFormat.CHANNEL_OUT_7POINT1; |
682 } | 681 } |
683 default: | 682 default: |
684 return AudioFormat.CHANNEL_OUT_DEFAULT; | 683 return AudioFormat.CHANNEL_OUT_DEFAULT; |
685 } | 684 } |
686 } | 685 } |
687 } | 686 } |
OLD | NEW |