[Freeswitch-svn] [commit] r5287 - in freeswitch/trunk/src/mod: codecs/mod_l16 endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Thu Jun 7 17:46:45 EDT 2007


Author: anthm
Date: Thu Jun  7 17:46:45 2007
New Revision: 5287

Modified:
   freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
sigh more stupidness

Modified: freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_l16/mod_l16.c	Thu Jun  7 17:46:45 2007
@@ -88,7 +88,7 @@
 
 static const switch_codec_implementation_t raw_32k_60ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 119,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 32000,
@@ -109,7 +109,7 @@
 
 static const switch_codec_implementation_t raw_32k_30ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 119,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 32000,
@@ -130,7 +130,7 @@
 
 static const switch_codec_implementation_t raw_32k_20ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 119,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 32000,
@@ -151,7 +151,7 @@
 
 static const switch_codec_implementation_t raw_32k_10ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 119,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 32000,
@@ -172,7 +172,7 @@
 
 static const switch_codec_implementation_t raw_22k_20ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 118,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 22050,
@@ -193,7 +193,7 @@
 
 static const switch_codec_implementation_t raw_16k_120ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 117,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second */ 8000,
@@ -214,7 +214,7 @@
 
 static const switch_codec_implementation_t raw_16k_60ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 117,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second */ 16000,
@@ -235,7 +235,7 @@
 
 static const switch_codec_implementation_t raw_16k_30ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 117,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second */ 16000,
@@ -256,7 +256,7 @@
 
 static const switch_codec_implementation_t raw_16k_20ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 117,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 16000,
@@ -277,7 +277,7 @@
 
 static const switch_codec_implementation_t raw_16k_10ms_implementation = {
 	/*.codec_type */ SWITCH_CODEC_TYPE_AUDIO,
-	/*.ianacode */ 10,
+	/*.ianacode */ 117,
 	/*.iananame */ "L16",
 	/*.fmtp */ NULL,
 	/*.samples_per_second = */ 16000,

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Thu Jun  7 17:46:45 2007
@@ -1145,19 +1145,24 @@
 
 				for (i = 0; i < tech_pvt->num_codecs; i++) {
 					const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-
+					uint32_t codec_rate = imp->samples_per_second;
 					if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
 						continue;
 					}
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d]/[%s:%d]\n",
-									  rm_encoding, map->rm_pt, imp->iananame, imp->ianacode);
+					
+					if (map->rm_pt == 9) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Oh sure! You say 8000, but you mean 16000! This is, of course, stupid!\n");
+						codec_rate = 16000;
+					}
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u]/[%s:%d:%u]\n",
+									  rm_encoding, map->rm_pt, (int)map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
 					if (map->rm_pt < 96) {
 						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
 					} else {
 						match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
 					}
 					
-					if (match && (map->rm_rate == imp->samples_per_second)) {
+					if (match && (map->rm_rate == codec_rate)) {
 						if (ptime && ptime * 1000 != imp->microseconds_per_frame) {
 							near_match = imp;
 							match = 0;



More information about the Freeswitch-svn mailing list