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

Asterisk Bug Tracker noreply at bugs.digium.com
Fri Jun 11 13:23:05 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
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:                       SWP-1145 
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-06-11 13:23 CDT
====================================================================== 
Summary:                    [patch] 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) {
    ...
}
====================================================================== 

---------------------------------------------------------------------- 
 (0123291) svnbot (reporter) - 2010-06-11 13:23
 https://issues.asterisk.org/view.php?id=15762#c123291 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 269960

U   branches/1.4/main/frame.c

------------------------------------------------------------------------
r269960 | tilghman | 2010-06-11 13:23:05 -0500 (Fri, 11 Jun 2010) | 8
lines

For SpeeX, 0 bits remaining is valid and does not need an emitted warning.

(closes issue https://issues.asterisk.org/view.php?id=15762)
 Reported by: nblasgen
 Patches: 
       issue15672.patch uploaded by pabelanger (license 224)
 Tested by: nblasgen

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=269960 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-06-11 13:23 svnbot         Checkin                                      
2010-06-11 13:23 svnbot         Note Added: 0123291                          
======================================================================




More information about the asterisk-bugs mailing list