summaryrefslogtreecommitdiff
path: root/src/opus_encoder.c
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2015-10-07 09:17:50 -0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2015-10-07 09:23:33 -0400
commit7c49ad0c5b1cd5ee830f449a34cc32b469db3cee (patch)
tree719c2440d2f734395240c899e4e2486aff4ec9b8 /src/opus_encoder.c
parent5dca296833ce4941dceadf956ff0fb6fe59fe4e8 (diff)
downloadopus-7c49ad0c5b1cd5ee830f449a34cc32b469db3cee.tar.gz
Preventing NaNs from crashing surround_analysis()
Diffstat (limited to 'src/opus_encoder.c')
-rw-r--r--src/opus_encoder.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index d94163f4..d11e972f 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1465,7 +1465,10 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
/* This should filter out both NaNs and ridiculous signals that could
cause NaNs further down. */
if (!(sum < 1e9f) || celt_isnan(sum))
+ {
OPUS_CLEAR(&pcm_buf[total_buffer*st->channels], frame_size*st->channels);
+ st->hp_mem[0] = st->hp_mem[1] = st->hp_mem[2] = st->hp_mem[3] = 0;
+ }
}
#endif