[asterisk-bugs] [Asterisk 0015762]: Frame.c adjustment for Speex

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Mar 23 11:11:37 CDT 2010


The following issue has been UPDATED. 
====================================================================== 
https://issues.asterisk.org/view.php?id=15762 
====================================================================== 
Reported By:                nblasgen
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   15762
Category:                   General
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     ready for review
Asterisk Version:           1.4.26.1 
JIRA:                        
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-08-23 13:02 CDT
Last Modified:              2010-03-23 11:11 CDT
====================================================================== 
Summary:                    Frame.c adjustment for Speex
Description: 
In function speex_samples, there is a test for the number of remaining
bits.

if ((len * 8 - bit) < 5) { ... }

The Speex docs (http://speex.org/docs/manual/speex-manual.ps) say in
Section 5.5 that:

"In cases where the number of frames is not determined by an out-of-band
mechanism, it is possible to include a terminator code. That terminator
consists of the code 15 (decimal) encoded with 5 bits, as shown in Table
9.2. Note that as of version 1.0.2, calling speex_bits_write automatically
inserts the terminator so as to fill the last byte. This doesn’t involves
any overhead and makes sure Speex can always detect when there is no more
frame in a packet."

Your code makes this terminator a requirement when 0 bits is also allowed,
though it might not be suggested.  I propose to add an extra line saying
the following:

if ((len * 8 - bit) == 0)
    break;
else if ((len * 8 - bit) < 5) {
    ...
}
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-03-23 11:11 russell        Description Updated                          
======================================================================




More information about the asterisk-bugs mailing list