diff options
Diffstat (limited to 'thirdparty/opus/opus.c')
-rw-r--r-- | thirdparty/opus/opus.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/thirdparty/opus/opus.c b/thirdparty/opus/opus.c index e9ce93b308..f76f125cfa 100644 --- a/thirdparty/opus/opus.c +++ b/thirdparty/opus/opus.c @@ -104,6 +104,10 @@ OPUS_EXPORT void opus_pcm_soft_clip(float *_x, int N, int C, float *declip_mem) /* Compute a such that maxval + a*maxval^2 = 1 */ a=(maxval-1)/(maxval*maxval); + /* Slightly boost "a" by 2^-22. This is just enough to ensure -ffast-math + does not cause output values larger than +/-1, but small enough not + to matter even for 24-bit output. */ + a += a*2.4e-7; if (x[i*C]>0) a = -a; /* Apply soft clipping */ @@ -201,8 +205,10 @@ int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, opus_int32 pad = 0; const unsigned char *data0 = data; - if (size==NULL) + if (size==NULL || len<0) return OPUS_BAD_ARG; + if (len==0) + return OPUS_INVALID_PACKET; framesize = opus_packet_get_samples_per_frame(data, 48000); |