summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-08 09:50:11 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-03-08 09:50:11 +0000
commit8e85b32bde4d99ccaa81382ec1dab8d1b9b1a5ce (patch)
treed1b68e227f7fbbfbf75b58eb25c6fb29f228352c
parent39d4c3efe8f0c379c77305d0cf83a1ae480f2930 (diff)
parente37bf1d2c2af24ab26ec4dfbc4ee318ab0bfe5e0 (diff)
downloadsonivox-android12L-platform-release.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/26372631'] into sc-v2-platform-release.android-platform-12.1.0_r27android12L-platform-release
Change-Id: I0fe8c94c14c2940e715025234181291d9aff2645
-rw-r--r--arm-wt-22k/lib_src/eas_wtengine.c24
-rw-r--r--arm-wt-22k/lib_src/eas_wtsynth.c12
2 files changed, 35 insertions, 1 deletions
diff --git a/arm-wt-22k/lib_src/eas_wtengine.c b/arm-wt-22k/lib_src/eas_wtengine.c
index b1ee749..dc8d864 100644
--- a/arm-wt-22k/lib_src/eas_wtengine.c
+++ b/arm-wt-22k/lib_src/eas_wtengine.c
@@ -99,6 +99,10 @@ void WT_VoiceGain (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pMixBuffer = pWTIntFrame->pMixBuffer;
pInputBuffer = pWTIntFrame->pAudioBuffer;
@@ -196,6 +200,10 @@ void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pOutputBuffer = pWTIntFrame->pAudioBuffer;
@@ -297,6 +305,10 @@ void WT_InterpolateNoLoop (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pOutputBuffer = pWTIntFrame->pAudioBuffer;
@@ -397,6 +409,10 @@ void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pAudioBuffer = pWTIntFrame->pAudioBuffer;
@@ -465,6 +481,10 @@ void WT_VoiceFilter (S_FILTER_CONTROL *pFilter, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pOutputBuffer = pWTIntFrame->pAudioBuffer;
phaseInc = pWTIntFrame->frame.phaseIncrement;
@@ -613,6 +633,10 @@ void WT_InterpolateMono (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame)
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
return;
+ } else if (numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d", numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
pMixBuffer = pWTIntFrame->pMixBuffer;
diff --git a/arm-wt-22k/lib_src/eas_wtsynth.c b/arm-wt-22k/lib_src/eas_wtsynth.c
index 74f78f5..ea1fe78 100644
--- a/arm-wt-22k/lib_src/eas_wtsynth.c
+++ b/arm-wt-22k/lib_src/eas_wtsynth.c
@@ -484,7 +484,12 @@ EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, E
/*lint -e{703} use shift for performance */
numSamples = (numSamples << NUM_PHASE_FRAC_BITS) - (EAS_I32) pWTVoice->phaseFrac;
if (pWTIntFrame->frame.phaseIncrement) {
- pWTIntFrame->numSamples = 1 + (numSamples / pWTIntFrame->frame.phaseIncrement);
+ EAS_I32 oldMethod = 1 + (numSamples / pWTIntFrame->frame.phaseIncrement);
+ pWTIntFrame->numSamples =
+ (numSamples + pWTIntFrame->frame.phaseIncrement - 1) / pWTIntFrame->frame.phaseIncrement;
+ if (oldMethod != pWTIntFrame->numSamples) {
+ ALOGE("b/317780080 old %ld new %ld", oldMethod, pWTIntFrame->numSamples);
+ }
} else {
pWTIntFrame->numSamples = numSamples;
}
@@ -492,6 +497,11 @@ EAS_BOOL WT_CheckSampleEnd (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame, E
ALOGE("b/26366256");
android_errorWriteLog(0x534e4554, "26366256");
pWTIntFrame->numSamples = 0;
+ } else if (pWTIntFrame->numSamples > BUFFER_SIZE_IN_MONO_SAMPLES) {
+ ALOGE("b/317780080 clip numSamples %ld -> %d",
+ pWTIntFrame->numSamples, BUFFER_SIZE_IN_MONO_SAMPLES);
+ android_errorWriteLog(0x534e4554, "317780080");
+ pWTIntFrame->numSamples = BUFFER_SIZE_IN_MONO_SAMPLES;
}
/* sound will be done this frame */