From cf5d3a8cf28d18145424f555b0060e4e9465b1da Mon Sep 17 00:00:00 2001 From: "Timothy B. Terriberry" <tterribe@xiph.org> Date: Wed, 2 Feb 2011 11:42:33 -0800 Subject: [PATCH] Fix short length detection. aa6fec66 added a check to reject modes with shorts longer than 3.33 ms (less than 300 per second). However, it only rejected modes which could not be split at all. This expands the check to also reject modes which, even after splitting the maximum amount, still do not have shorts less than 3.33 ms. --- libcelt/modes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libcelt/modes.c b/libcelt/modes.c index 2b2e68664..ca509921e 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -323,12 +323,13 @@ CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error) } else if ((celt_int32)frame_size*300 >= Fs && (frame_size%4)==0) { LM = 1; - } else if ((celt_int32)frame_size*300 <= Fs) + } else { LM = 0; } + /* Shorts longer than 3.3ms are not supported. */ - else + if ((celt_int32)(frame_size>>LM)*300 > Fs) { if (error) *error = CELT_INVALID_MODE; -- GitLab