| Index: media/base/android/media_codec_bridge.cc
|
| diff --git a/media/base/android/media_codec_bridge.cc b/media/base/android/media_codec_bridge.cc
|
| index 9bae69edd36f1d72d57318f82f220be973df71e2..ef4de25dd147ae6560e0170ff8ad5e86311f5fe0 100644
|
| --- a/media/base/android/media_codec_bridge.cc
|
| +++ b/media/base/android/media_codec_bridge.cc
|
| @@ -10,7 +10,6 @@
|
| #include "base/android/jni_android.h"
|
| #include "base/android/jni_array.h"
|
| #include "base/android/jni_string.h"
|
| -#include "base/basictypes.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| #include "base/numerics/safe_conversions.h"
|
| @@ -322,11 +321,12 @@ int MediaCodecBridge::GetOutputSamplingRate() {
|
|
|
| MediaCodecStatus MediaCodecBridge::QueueInputBuffer(
|
| int index,
|
| - const uint8* data,
|
| + const uint8_t* data,
|
| size_t data_size,
|
| const base::TimeDelta& presentation_time) {
|
| DVLOG(3) << __PRETTY_FUNCTION__ << index << ": " << data_size;
|
| - if (data_size > base::checked_cast<size_t>(kint32max))
|
| + if (data_size >
|
| + base::checked_cast<size_t>(std::numeric_limits<int32_t>::max()))
|
| return MEDIA_CODEC_ERROR;
|
| if (data && !FillInputBuffer(index, data, data_size))
|
| return MEDIA_CODEC_ERROR;
|
| @@ -343,7 +343,7 @@ MediaCodecStatus MediaCodecBridge::QueueInputBuffer(
|
|
|
| MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
|
| int index,
|
| - const uint8* data,
|
| + const uint8_t* data,
|
| size_t data_size,
|
| const std::string& key_id,
|
| const std::string& iv,
|
| @@ -360,17 +360,18 @@ MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
|
| // interface after we switch to Spitzer pipeline.
|
| MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
|
| int index,
|
| - const uint8* data,
|
| + const uint8_t* data,
|
| size_t data_size,
|
| - const uint8* key_id,
|
| + const uint8_t* key_id,
|
| int key_id_size,
|
| - const uint8* iv,
|
| + const uint8_t* iv,
|
| int iv_size,
|
| const SubsampleEntry* subsamples,
|
| int subsamples_size,
|
| const base::TimeDelta& presentation_time) {
|
| DVLOG(3) << __PRETTY_FUNCTION__ << index << ": " << data_size;
|
| - if (data_size > base::checked_cast<size_t>(kint32max))
|
| + if (data_size >
|
| + base::checked_cast<size_t>(std::numeric_limits<int32_t>::max()))
|
| return MEDIA_CODEC_ERROR;
|
| if (data && !FillInputBuffer(index, data, data_size))
|
| return MEDIA_CODEC_ERROR;
|
| @@ -398,9 +399,9 @@ MediaCodecStatus MediaCodecBridge::QueueSecureInputBuffer(
|
| DCHECK_GT(subsamples_size, 0);
|
| DCHECK(subsamples);
|
| for (int i = 0; i < subsamples_size; ++i) {
|
| - DCHECK(subsamples[i].clear_bytes <= std::numeric_limits<uint16>::max());
|
| + DCHECK(subsamples[i].clear_bytes <= std::numeric_limits<uint16_t>::max());
|
| if (subsamples[i].cypher_bytes >
|
| - static_cast<uint32>(std::numeric_limits<jint>::max())) {
|
| + static_cast<uint32_t>(std::numeric_limits<jint>::max())) {
|
| return MEDIA_CODEC_ERROR;
|
| }
|
|
|
| @@ -510,12 +511,12 @@ size_t MediaCodecBridge::GetOutputBuffersCapacity() {
|
| }
|
|
|
| void MediaCodecBridge::GetInputBuffer(int input_buffer_index,
|
| - uint8** data,
|
| + uint8_t** data,
|
| size_t* capacity) {
|
| JNIEnv* env = AttachCurrentThread();
|
| ScopedJavaLocalRef<jobject> j_buffer(Java_MediaCodecBridge_getInputBuffer(
|
| env, j_media_codec_.obj(), input_buffer_index));
|
| - *data = static_cast<uint8*>(env->GetDirectBufferAddress(j_buffer.obj()));
|
| + *data = static_cast<uint8_t*>(env->GetDirectBufferAddress(j_buffer.obj()));
|
| *capacity = base::checked_cast<size_t>(
|
| env->GetDirectBufferCapacity(j_buffer.obj()));
|
| }
|
| @@ -538,15 +539,16 @@ int MediaCodecBridge::GetOutputBufferAddress(int index,
|
| JNIEnv* env = AttachCurrentThread();
|
| ScopedJavaLocalRef<jobject> j_buffer(
|
| Java_MediaCodecBridge_getOutputBuffer(env, j_media_codec_.obj(), index));
|
| - *addr = reinterpret_cast<uint8*>(
|
| - env->GetDirectBufferAddress(j_buffer.obj())) + offset;
|
| + *addr =
|
| + reinterpret_cast<uint8_t*>(env->GetDirectBufferAddress(j_buffer.obj())) +
|
| + offset;
|
| return env->GetDirectBufferCapacity(j_buffer.obj()) - offset;
|
| }
|
|
|
| bool MediaCodecBridge::FillInputBuffer(int index,
|
| - const uint8* data,
|
| + const uint8_t* data,
|
| size_t size) {
|
| - uint8* dst = NULL;
|
| + uint8_t* dst = NULL;
|
| size_t capacity = 0;
|
| GetInputBuffer(index, &dst, &capacity);
|
| CHECK(dst);
|
| @@ -569,10 +571,10 @@ AudioCodecBridge::AudioCodecBridge(const std::string& mime)
|
| bool AudioCodecBridge::Start(const AudioCodec& codec,
|
| int sample_rate,
|
| int channel_count,
|
| - const uint8* extra_data,
|
| + const uint8_t* extra_data,
|
| size_t extra_data_size,
|
| - int64 codec_delay_ns,
|
| - int64 seek_preroll_ns,
|
| + int64_t codec_delay_ns,
|
| + int64_t seek_preroll_ns,
|
| bool play_audio,
|
| jobject media_crypto) {
|
| JNIEnv* env = AttachCurrentThread();
|
| @@ -605,10 +607,10 @@ bool AudioCodecBridge::Start(const AudioCodec& codec,
|
|
|
| bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
| const AudioCodec& codec,
|
| - const uint8* extra_data,
|
| + const uint8_t* extra_data,
|
| size_t extra_data_size,
|
| - int64 codec_delay_ns,
|
| - int64 seek_preroll_ns) {
|
| + int64_t codec_delay_ns,
|
| + int64_t seek_preroll_ns) {
|
| if (extra_data_size == 0 && codec != kCodecOpus)
|
| return true;
|
|
|
| @@ -625,7 +627,7 @@ bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
| // |total_length| keeps track of the total number of bytes before the last
|
| // header.
|
| size_t total_length = 1;
|
| - const uint8* current_pos = extra_data;
|
| + const uint8_t* current_pos = extra_data;
|
| // Calculate the length of the first 2 headers.
|
| for (int i = 0; i < 2; ++i) {
|
| header_length[i] = 0;
|
| @@ -664,9 +666,9 @@ bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
|
|
| // The following code is copied from aac.cc
|
| // TODO(qinmin): refactor the code in aac.cc to make it more reusable.
|
| - uint8 profile = 0;
|
| - uint8 frequency_index = 0;
|
| - uint8 channel_config = 0;
|
| + uint8_t profile = 0;
|
| + uint8_t frequency_index = 0;
|
| + uint8_t channel_config = 0;
|
| RETURN_ON_ERROR(reader.ReadBits(5, &profile));
|
| RETURN_ON_ERROR(reader.ReadBits(4, &frequency_index));
|
|
|
| @@ -688,7 +690,7 @@ bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
| return false;
|
| }
|
| const size_t kCsdLength = 2;
|
| - uint8 csd[kCsdLength];
|
| + uint8_t csd[kCsdLength];
|
| csd[0] = profile << 3 | frequency_index >> 1;
|
| csd[1] = (frequency_index & 0x01) << 7 | channel_config << 3;
|
| ScopedJavaLocalRef<jbyteArray> byte_array =
|
| @@ -714,17 +716,15 @@ bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
| Java_MediaCodecBridge_setCodecSpecificData(env, j_format, 0, csd0.obj());
|
|
|
| // csd1 - Codec Delay
|
| - ScopedJavaLocalRef<jbyteArray> csd1 =
|
| - base::android::ToJavaByteArray(
|
| - env, reinterpret_cast<const uint8*>(&codec_delay_ns),
|
| - sizeof(int64_t));
|
| + ScopedJavaLocalRef<jbyteArray> csd1 = base::android::ToJavaByteArray(
|
| + env, reinterpret_cast<const uint8_t*>(&codec_delay_ns),
|
| + sizeof(int64_t));
|
| Java_MediaCodecBridge_setCodecSpecificData(env, j_format, 1, csd1.obj());
|
|
|
| // csd2 - Seek Preroll
|
| - ScopedJavaLocalRef<jbyteArray> csd2 =
|
| - base::android::ToJavaByteArray(
|
| - env, reinterpret_cast<const uint8*>(&seek_preroll_ns),
|
| - sizeof(int64_t));
|
| + ScopedJavaLocalRef<jbyteArray> csd2 = base::android::ToJavaByteArray(
|
| + env, reinterpret_cast<const uint8_t*>(&seek_preroll_ns),
|
| + sizeof(int64_t));
|
| Java_MediaCodecBridge_setCodecSpecificData(env, j_format, 2, csd2.obj());
|
| break;
|
| }
|
| @@ -736,10 +736,10 @@ bool AudioCodecBridge::ConfigureMediaFormat(jobject j_format,
|
| return true;
|
| }
|
|
|
| -int64 AudioCodecBridge::PlayOutputBuffer(int index,
|
| - size_t size,
|
| - size_t offset,
|
| - bool postpone) {
|
| +int64_t AudioCodecBridge::PlayOutputBuffer(int index,
|
| + size_t size,
|
| + size_t offset,
|
| + bool postpone) {
|
| DCHECK_LE(0, index);
|
| int numBytes = base::checked_cast<int>(size);
|
|
|
| @@ -750,7 +750,7 @@ int64 AudioCodecBridge::PlayOutputBuffer(int index,
|
|
|
| JNIEnv* env = AttachCurrentThread();
|
| ScopedJavaLocalRef<jbyteArray> byte_array = base::android::ToJavaByteArray(
|
| - env, static_cast<uint8*>(buffer), numBytes);
|
| + env, static_cast<uint8_t*>(buffer), numBytes);
|
| return Java_MediaCodecBridge_playOutputBuffer(env, media_codec(),
|
| byte_array.obj(), postpone);
|
| }
|
|
|