diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-07 21:24:58 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-01-11 13:44:33 +0100 |
commit | f0e7aec5da5de7fa825397feb9b1cec402d77cee (patch) | |
tree | cbfc951393d2e33cfa21c65d2c98cffa39c9ddfa | |
parent | c7fbaa67c6089fdb2682984d8d4a6f484c1eb49d (diff) | |
download | UXP-f0e7aec5da5de7fa825397feb9b1cec402d77cee.tar UXP-f0e7aec5da5de7fa825397feb9b1cec402d77cee.tar.gz UXP-f0e7aec5da5de7fa825397feb9b1cec402d77cee.tar.lz UXP-f0e7aec5da5de7fa825397feb9b1cec402d77cee.tar.xz UXP-f0e7aec5da5de7fa825397feb9b1cec402d77cee.zip |
Reject sample rates that are out-of-range for libsoundtouch.
We never reach this with our normal use of this lib but adding the
sanity check just in case. (ported from upstream)
-rw-r--r-- | media/libsoundtouch/src/SoundTouch.cpp | 2 | ||||
-rw-r--r-- | media/libsoundtouch/src/TDStretch.cpp | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/media/libsoundtouch/src/SoundTouch.cpp b/media/libsoundtouch/src/SoundTouch.cpp index a9d23fc3c..955818810 100644 --- a/media/libsoundtouch/src/SoundTouch.cpp +++ b/media/libsoundtouch/src/SoundTouch.cpp @@ -283,9 +283,9 @@ void SoundTouch::calcEffectiveRateAndTempo() // Sets sample rate. void SoundTouch::setSampleRate(uint srate) { - bSrateSet = true; // set sample rate, leave other tempo changer parameters as they are. pTDStretch->setParameters((int)srate); + bSrateSet = true; } diff --git a/media/libsoundtouch/src/TDStretch.cpp b/media/libsoundtouch/src/TDStretch.cpp index 81bde22f0..b955bfc96 100644 --- a/media/libsoundtouch/src/TDStretch.cpp +++ b/media/libsoundtouch/src/TDStretch.cpp @@ -126,8 +126,13 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS, int aSeekWindowMS, int aOverlapMS) { // accept only positive parameter values - if zero or negative, use old values instead - if (aSampleRate > 0) this->sampleRate = aSampleRate; - if (aOverlapMS > 0) this->overlapMs = aOverlapMS; + if (aSampleRate > 0) + { + if (aSampleRate > 192000) ST_THROW_RT_ERROR("Error: Excessive samplerate"); + this->sampleRate = aSampleRate; + } + + if (aOverlapMS > 0) this->overlapMs = aOverlapMS; if (aSequenceMS > 0) { |