[svn-commits] mjordan: branch 10 r362377 - in /branches/10: ./ main/format_pref.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Apr 17 16:22:49 CDT 2012


Author: mjordan
Date: Tue Apr 17 16:22:37 2012
New Revision: 362377

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=362377
Log:
Handle case where an unknown format is used to get the preferred codec size

In ast_codec_pref_getsize, if an unknown format is passed to the method,
no preferred codec will be selected and a negative number will be used to
index into the format list.  The method now logs an unknown format as a
warning, and returns an empty format list.

(issue ASTERISK-19655)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/1863/


Modified:
    branches/10/   (props changed)
    branches/10/main/format_pref.c

Propchange: branches/10/
------------------------------------------------------------------------------
--- branch-1.8-blocked (original)
+++ branch-1.8-blocked Tue Apr 17 16:22:37 2012
@@ -1,1 +1,1 @@
-/branches/1.8:299531,313436,317858,317861,321335,321753,322585,323730,328446,329782,330491,330510,335431,335714,351765,352287,353818,355839,359534,360473
+/branches/1.8:299531,313436,317858,317861,321335,321753,322585,323730,328446,329782,330491,330510,335431,335714,351765,352287,353818,355839,359534,360473,362368

Modified: branches/10/main/format_pref.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/format_pref.c?view=diff&rev=362377&r1=362376&r2=362377
==============================================================================
--- branches/10/main/format_pref.c (original)
+++ branches/10/main/format_pref.c Tue Apr 17 16:22:37 2012
@@ -274,6 +274,11 @@
 		}
 	}
 
+	if (idx < 0) {
+		ast_log(AST_LOG_WARNING, "Format %s unknown; unable to get preferred codec packet size\n", ast_getformatname(format));
+		return fmt;
+	}
+
 	for (x = 0; x < f_len; x++) {
 		if (pref->order[x] == (idx + 1)) {
 			framems = pref->framing[x];




More information about the svn-commits mailing list