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

Commit 69ec67ef authored by Jia Jia's avatar Jia Jia
Browse files

Fixed audioserver crash in monkey test

Enable log function in ToneGenerator.cpp, then ToneGenerator
plays consecutively many times and do not stopTone.

"lpToneGen->mNextSegSmp*1000" will go beyond the scope of unsigned
int, and audioserver get crashed.

Test: Enable log function in ToneGenerator.cpp, alarm notification is
played when the phone is online. ToneGenerator plays consecutively.
Do not stopTone. then we get audioserver crash.

Change-Id: I073590088fccb32a73353d14970dc89441045663
parent 9d431cef
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1367,16 +1367,18 @@ void ToneGenerator::audioCallback(int event, void* user, void *info) {
                        lWaveCmd = WaveGenerator::WAVEGEN_START;
                    }

                    ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment,
                            (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
                    ALOGV("New segment %d, Next Time: %lld", lpToneGen->mCurSegment,
                            ((long long)(lpToneGen->mNextSegSmp)*1000)/lpToneGen->mSamplingRate);


                } else {
                    lGenSmp = 0;
                    ALOGV("End repeat, time: %d", (unsigned int)(systemTime()/1000000));
                }
            } else {
                ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment,
                        (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
                ALOGV("New segment %d, Next Time: %lld", lpToneGen->mCurSegment,
                        ((long long)(lpToneGen->mNextSegSmp)*1000)/lpToneGen->mSamplingRate);

                if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) {
                    // If next segment is not silent,  OFF -> ON transition : reset wave generator
                    lWaveCmd = WaveGenerator::WAVEGEN_START;