Merge "Remove ScopedBytes use"

am: 422fa22456

Change-Id: I2fcd6bc031e146d34f322476e2850e1773ea4cb5
This commit is contained in:
Orion Hodson
2018-12-09 12:09:15 -08:00
committed by android-build-merger
2 changed files with 7 additions and 8 deletions

View File

@@ -23,8 +23,6 @@
#include <nativehelper/JniConstants.h>
#include "core_jni_helpers.h"
#include <nativehelper/ScopedBytes.h>
#include <utils/Log.h>
#include <media/AudioSystem.h>
#include <media/AudioTrack.h>
@@ -699,7 +697,7 @@ static jint android_media_AudioTrack_writeArray(JNIEnv *env, jobject thiz,
// ----------------------------------------------------------------------------
static jint android_media_AudioTrack_write_native_bytes(JNIEnv *env, jobject thiz,
jbyteArray javaBytes, jint byteOffset, jint sizeInBytes,
jobject javaByteBuffer, jint byteOffset, jint sizeInBytes,
jint javaAudioFormat, jboolean isWriteBlocking) {
//ALOGV("android_media_AudioTrack_write_native_bytes(offset=%d, sizeInBytes=%d) called",
// offsetInBytes, sizeInBytes);
@@ -710,13 +708,14 @@ static jint android_media_AudioTrack_write_native_bytes(JNIEnv *env, jobject th
return (jint)AUDIO_JAVA_INVALID_OPERATION;
}
ScopedBytesRO bytes(env, javaBytes);
if (bytes.get() == NULL) {
const jbyte* bytes =
reinterpret_cast<const jbyte*>(env->GetDirectBufferAddress(javaByteBuffer));
if (bytes == NULL) {
ALOGE("Error retrieving source of audio data to play, can't play");
return (jint)AUDIO_JAVA_BAD_VALUE;
}
jint written = writeToTrack(lpTrack, javaAudioFormat, bytes.get(), byteOffset,
jint written = writeToTrack(lpTrack, javaAudioFormat, bytes, byteOffset,
sizeInBytes, isWriteBlocking == JNI_TRUE /* blocking */);
return written;
@@ -1288,7 +1287,7 @@ static const JNINativeMethod gMethods[] = {
{"native_release", "()V", (void *)android_media_AudioTrack_release},
{"native_write_byte", "([BIIIZ)I",(void *)android_media_AudioTrack_writeArray<jbyteArray>},
{"native_write_native_bytes",
"(Ljava/lang/Object;IIIZ)I",
"(Ljava/nio/ByteBuffer;IIIZ)I",
(void *)android_media_AudioTrack_write_native_bytes},
{"native_write_short", "([SIIIZ)I",(void *)android_media_AudioTrack_writeArray<jshortArray>},
{"native_write_float", "([FIIIZ)I",(void *)android_media_AudioTrack_writeArray<jfloatArray>},

View File

@@ -3222,7 +3222,7 @@ public class AudioTrack extends PlayerBase
int offsetInFloats, int sizeInFloats, int format,
boolean isBlocking);
private native final int native_write_native_bytes(Object audioData,
private native final int native_write_native_bytes(ByteBuffer audioData,
int positionInBytes, int sizeInBytes, int format, boolean blocking);
private native final int native_reload_static();