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

Commit c7079663 authored by Paul McLean's avatar Paul McLean
Browse files

Fix unitialized member/init-parameter in AudioTrack(long) and AudioRecord(long).

Bug: 27381351

Change-Id: Ia11c13bde978dbf1707439b82a18abf22fe23f2f
parent 9b09e533
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -395,20 +395,21 @@ public class AudioRecord implements AudioRouting
     */
     */
    /*package*/ AudioRecord(long nativeRecordInJavaObj) {
    /*package*/ AudioRecord(long nativeRecordInJavaObj) {
        int[] session = { 0 };
        int[] session = { 0 };
        int[] rates = { 0 };
        //TODO: update native initialization when information about hardware init failure
        //TODO: update native initialization when information about hardware init failure
        //      due to capture device already open is available.
        //      due to capture device already open is available.
        // Note that for this native_setup, we are providing an already created/initialized
        // Note that for this native_setup, we are providing an already created/initialized
        // *Native* AudioRecord, so the attributes parameters to native_setup() are ignored.
        // *Native* AudioRecord, so the attributes parameters to native_setup() are ignored.
        int initResult = native_setup(new WeakReference<AudioRecord>(this),
        int initResult = native_setup(new WeakReference<AudioRecord>(this),
                null /*mAudioAttributes*/,
                null /*mAudioAttributes*/,
                null /*mSampleRates*/,
                rates /*mSampleRates*/,
                0 /*mChannelMask*/,
                0 /*mChannelMask*/,
                0 /*mChannelIndexMask*/,
                0 /*mChannelIndexMask*/,
                0 /*mAudioFormat*/,
                0 /*mAudioFormat*/,
                0 /*mNativeBufferSizeInBytes*/,
                0 /*mNativeBufferSizeInBytes*/,
                session,
                session,
                ActivityThread.currentOpPackageName(),
                ActivityThread.currentOpPackageName(),
                mNativeRecorderInJavaObj);
                nativeRecordInJavaObj);
        if (initResult != SUCCESS) {
        if (initResult != SUCCESS) {
            loge("Error code "+initResult+" when initializing native AudioRecord object.");
            loge("Error code "+initResult+" when initializing native AudioRecord object.");
            return; // with mState == STATE_UNINITIALIZED
            return; // with mState == STATE_UNINITIALIZED
+3 −2
Original line number Original line Diff line number Diff line
@@ -543,16 +543,17 @@ public class AudioTrack implements AudioRouting
        // Note that for this native_setup, we are providing an already created/initialized
        // Note that for this native_setup, we are providing an already created/initialized
        // *Native* AudioTrack, so the attributes parameters to native_setup() are ignored.
        // *Native* AudioTrack, so the attributes parameters to native_setup() are ignored.
        int[] session = { 0 };
        int[] session = { 0 };
        int[] rates = { 0 };
        int initResult = native_setup(new WeakReference<AudioTrack>(this),
        int initResult = native_setup(new WeakReference<AudioTrack>(this),
                null /*mAttributes - NA*/,
                null /*mAttributes - NA*/,
                null /*sampleRate - NA*/,
                rates /*sampleRate - NA*/,
                0 /*mChannelMask - NA*/,
                0 /*mChannelMask - NA*/,
                0 /*mChannelIndexMask - NA*/,
                0 /*mChannelIndexMask - NA*/,
                0 /*mAudioFormat - NA*/,
                0 /*mAudioFormat - NA*/,
                0 /*mNativeBufferSizeInBytes - NA*/,
                0 /*mNativeBufferSizeInBytes - NA*/,
                0 /*mDataLoadMode - NA*/,
                0 /*mDataLoadMode - NA*/,
                session,
                session,
                mNativeTrackInJavaObj);
                nativeTrackInJavaObj);
        if (initResult != SUCCESS) {
        if (initResult != SUCCESS) {
            loge("Error code "+initResult+" when initializing AudioTrack.");
            loge("Error code "+initResult+" when initializing AudioTrack.");
            return; // with mState == STATE_UNINITIALIZED
            return; // with mState == STATE_UNINITIALIZED