Module: sems Branch: master Commit: d3231592a8815331758c6af5abfdac0a492b47e4 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=d3231592a8815331758c6af5abfdac0a492b47e4
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Fri Mar 4 14:10:09 2011 +0100 b/f: speex parameter negotiation with quotes patch by Aymeric Moyzard (amoizard a gmail) --- core/plug-in/speex/speex.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/plug-in/speex/speex.c b/core/plug-in/speex/speex.c index da206c8..9191e89 100644 --- a/core/plug-in/speex/speex.c +++ b/core/plug-in/speex/speex.c @@ -133,7 +133,7 @@ static char* read_param(char* input, const char *param, char** param_value) int param_size; /* Eat spaces and semi-colons */ - while (*input==' ' && *input==';' && *input!='"') + while (*input && *input==' ' && *input==';' && *input!='"') input++; *param_value = NULL; @@ -148,7 +148,15 @@ static char* read_param(char* input, const char *param, char** param_value) *param_value = input; while (*input && *input!=' ' && *input!=';' && *input!='"') input++; - + if (*input=='"') + { + *param_value = *param_value+1; /* remove " */ + /* string will end after next: " */ + while (*input && *input!='"' && *input!='\r' && *input!='\n') + input++; + if (*input=='"') + input--; /* remove " */ + } if (*input) *input++ = 0; @@ -187,7 +195,7 @@ long speexNB_create(const char* format_parameters, amci_codec_fmt_info_t* format strcpy(buffer, format_parameters); while (*buffer) { - char* error; + char *error=NULL; char *param_value; /* Speex encoding mode (assume NB) */ @@ -196,7 +204,8 @@ long speexNB_create(const char* format_parameters, amci_codec_fmt_info_t* format int mode; if (strcmp(param_value, "any")) { mode = strtol(param_value, &error, 10); - if (!*error && mode>=0 && mode<=8) + DBG("get SDP mode param=%s\n", param_value); + if (error!=NULL && error!=param_value && mode>=0 && mode<=8) ss->mode = mode; } continue; _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
