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

Commit db372594 authored by Eric Laurent's avatar Eric Laurent
Browse files

ToneGenerator: fix AudioTrack pointer init

The pointer to AudioTrack should be initialized before
early return from ToneGenerator constructor because
it is tested by the destructor.

Bug 8140963

Change-Id: I9a7dfb60ba162b75dfaa5630ab7fc9485afd0074
parent 190cdbab
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -803,6 +803,7 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool
    ALOGV("ToneGenerator constructor: streamType=%d, volume=%f", streamType, volume);

    mState = TONE_IDLE;
    mpAudioTrack = NULL;

    if (AudioSystem::getOutputSamplingRate(&mSamplingRate, streamType) != NO_ERROR) {
        ALOGE("Unable to marshal AudioFlinger");
@@ -811,7 +812,6 @@ ToneGenerator::ToneGenerator(audio_stream_type_t streamType, float volume, bool
    mThreadCanCallJava = threadCanCallJava;
    mStreamType = streamType;
    mVolume = volume;
    mpAudioTrack = NULL;
    mpToneDesc = NULL;
    mpNewToneDesc = NULL;
    // Generate tone by chunks of 20 ms to keep cadencing precision