Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6a49777 authored by Orion Hodson's avatar Orion Hodson Committed by android-build-merger
Browse files

Merge "Remove ScopedBytes use" am: 422fa224 am: 7c580212

am: 2e09a6b6

Change-Id: Ieda76179a3e533230d14d19a4fef84e3b8f55394
parents 80b8ce88 2e09a6b6
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -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>
@@ -712,7 +710,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);
@@ -723,13 +721,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;
@@ -1308,7 +1307,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>},
+1 −1
Original line number Diff line number Diff line
@@ -3365,7 +3365,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();