aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <rago@google.com>2023-09-11 20:35:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-09-11 20:35:44 +0000
commit075af7954c09d7ea000105d6c1b8d96a747e7abe (patch)
tree4439b5067867f2bfe48e2fd2b596aae77dab28e4
parenta25bf35bd8469ccf58f6024199bd972419d34547 (diff)
parent1be8e5888f6273b8bbab9005127d30ec0518bc0d (diff)
downloadsonic-075af7954c09d7ea000105d6c1b8d96a747e7abe.tar.gz
Upgrade sonic to 9a8d05dc0baa9159fc322dd9905a04e23b161337 am: 3780ebacad am: 09aec82f0d am: 1be8e5888f
Original change: https://android-review.googlesource.com/c/platform/external/sonic/+/2745925 Change-Id: Ieece4d60f20fe9df57c756fdde2f5fa09e4bd1ab Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--METADATA10
-rw-r--r--sonic.c13
2 files changed, 10 insertions, 13 deletions
diff --git a/METADATA b/METADATA
index c531560..a800c58 100644
--- a/METADATA
+++ b/METADATA
@@ -1,19 +1,19 @@
# This project was upgraded with external_updater.
# Usage: tools/external_updater/updater.sh update sonic
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "sonic"
description: "Sonic is a simple algorithm for speeding up or slowing down speech."
third_party {
url {
type: ARCHIVE
- value: "https://github.com/waywardgeek/sonic/archive/0555641f2d7e52a3d1720b4ae5affb5d50bdde23.zip"
+ value: "https://github.com/waywardgeek/sonic/archive/9a8d05dc0baa9159fc322dd9905a04e23b161337.zip"
}
- version: "0555641f2d7e52a3d1720b4ae5affb5d50bdde23"
+ version: "9a8d05dc0baa9159fc322dd9905a04e23b161337"
license_type: NOTICE
last_upgrade_date {
year: 2023
- month: 5
- day: 3
+ month: 9
+ day: 9
}
}
diff --git a/sonic.c b/sonic.c
index 27fcaff..c18fc6e 100644
--- a/sonic.c
+++ b/sonic.c
@@ -391,7 +391,7 @@ static int allocateStreamBuffers(sonicStream stream, int sampleRate,
/* Allocate 25% more than needed so we hopefully won't grow. */
stream->pitchBufferSize = maxRequired + (maxRequired >> 2);
stream->pitchBuffer =
- (short*)sonicCalloc(maxRequired, sizeof(short) * numChannels);
+ (short*)sonicCalloc(stream->pitchBufferSize, sizeof(short) * numChannels);
if (stream->pitchBuffer == NULL) {
sonicDestroyStream(stream);
return 0;
@@ -887,15 +887,12 @@ static int moveNewSamplesToPitchBuffer(sonicStream stream,
int originalNumOutputSamples) {
int numSamples = stream->numOutputSamples - originalNumOutputSamples;
int numChannels = stream->numChannels;
+ int pitchBufferSize = stream->pitchBufferSize;
- if (stream->numPitchSamples + numSamples > stream->pitchBufferSize) {
- int pitchBufferSize = stream->pitchBufferSize;
+ if (stream->numPitchSamples + numSamples > pitchBufferSize) {
stream->pitchBufferSize += (pitchBufferSize >> 1) + numSamples;
- stream->pitchBuffer = (short*)sonicRealloc(
- stream->pitchBuffer,
- pitchBufferSize,
- stream->pitchBufferSize,
- sizeof(short) * numChannels);
+ stream->pitchBuffer = (short*)sonicRealloc(stream->pitchBuffer,
+ pitchBufferSize, stream->pitchBufferSize, sizeof(short) * numChannels);
}
memcpy(stream->pitchBuffer + stream->numPitchSamples * numChannels,
stream->outputBuffer + originalNumOutputSamples * numChannels,