[Freeswitch-svn] [commit] r10797 - freeswitch/trunk/src
FreeSWITCH SVN
anthm at freeswitch.org
Tue Dec 16 08:40:39 PST 2008
Author: anthm
Date: Tue Dec 16 11:40:38 2008
New Revision: 10797
Log:
tweak codec lookup func
Modified:
freeswitch/trunk/src/switch_loadable_module.c
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Tue Dec 16 11:40:38 2008
@@ -1415,7 +1415,7 @@
for (x = 0; x < preflen; x++) {
char *cur, *last = NULL, *next = NULL, *name, *p, buf[256];
- uint32_t interval = 0, rate = 8000;
+ uint32_t interval = 0, rate = 0;
switch_copy_string(buf, prefs[x], sizeof(buf));
last = name = next = cur = buf;
@@ -1442,25 +1442,25 @@
if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0) {
/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
- if (!interval) {
- for (imp = codec_interface->implementations; imp; imp = imp->next) {
- uint8_t match = 1;
-
- if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
- if ((uint32_t) (imp->microseconds_per_packet / 1000) != 20) {
- match = 0;
- }
-
- if (match && rate && (uint32_t) imp->samples_per_second != rate) {
- match = 0;
- }
+ for (imp = codec_interface->implementations; imp; imp = imp->next) {
+ uint8_t match = 1;
+
+ if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
+
+ if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != 20) ||
+ (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) {
+ match = 0;
}
- if (match) {
- array[i++] = imp;
- goto found;
+ if (match && ((!rate && (uint32_t) imp->samples_per_second != 8000) || (rate && (uint32_t) imp->samples_per_second != rate))) {
+ match = 0;
}
}
+
+ if (match) {
+ array[i++] = imp;
+ goto found;
+ }
}
/* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */
@@ -1468,10 +1468,11 @@
uint8_t match = 1;
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
+
if (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval) {
match = 0;
}
-
+
if (match && rate && (uint32_t) imp->samples_per_second != rate) {
match = 0;
}
More information about the Freeswitch-svn
mailing list