summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2020-09-05 18:15:03 -0400
committerSolomon Peachy <pizza@shaftnet.org>2020-09-08 13:38:26 +0000
commit49a2953ade02c351498b5af382a97624ad82779a (patch)
treece34aa7b67d9668024e20b041dc538eac37d5150
parentaf24ff1fc364343bd94a7473e48ae707936d3f7f (diff)
downloadrockbox-49a2953ade02c351498b5af382a97624ad82779a.tar.gz
rockbox-49a2953ade02c351498b5af382a97624ad82779a.zip
surround: Fix two issues with the haas surround code.
1) Handle ID 0 is legal 2) Make sure handle is initialized before trying to memset its buffer Change-Id: I91db157863800c01dd9b92bc05a1df5c4fe0e95b
-rw-r--r--lib/rbcodec/dsp/surround.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/rbcodec/dsp/surround.c b/lib/rbcodec/dsp/surround.c
index 1a24d615fc..986d81ae6f 100644
--- a/lib/rbcodec/dsp/surround.c
+++ b/lib/rbcodec/dsp/surround.c
@@ -78,7 +78,8 @@ static void surround_buffer_free(void)
78 78
79static void dsp_surround_flush(void) 79static void dsp_surround_flush(void)
80{ 80{
81 memset(core_get_data(handle), 0, SURROUND_BUFSIZE); 81 if (handle >= 0)
82 memset(core_get_data(handle), 0, SURROUND_BUFSIZE);
82} 83}
83 84
84static void surround_update_filter(unsigned int fout) 85static void surround_update_filter(unsigned int fout)
@@ -121,7 +122,7 @@ void dsp_surround_set_cutoff(int frq_l, int frq_h)
121 122
122static void surround_set_stepsize(int surround_strength) 123static void surround_set_stepsize(int surround_strength)
123{ 124{
124 if (handle > 0) 125 if (handle >= 0)
125 dsp_surround_flush(); 126 dsp_surround_flush();
126 127
127 switch(surround_strength) 128 switch(surround_strength)