]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4846 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 7 Mar 2013 22:21:37 +0000 (16:21 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 7 Mar 2013 22:21:37 +0000 (16:21 -0600)
src/include/switch_core.h
src/switch_core.c
src/switch_loadable_module.c

index 3383b67bc00c8432a70df6d356119da4891def6a..78b3827aa9d1ee5d61ff189ef0c787e314f83455 100644 (file)
@@ -2396,6 +2396,7 @@ SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
 SWITCH_DECLARE(const char *) switch_core_banner(void);
 SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session);
 SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number);
+SWITCH_DECLARE(uint32_t) switch_default_rate(const char *name, uint32_t number);
 
 /*!
  \brief Add user registration
index 2ead1171212a2e836cc499d32edf9848f7d75c25..60e133c73014a2502e1f37bc60b26a9cb4c0cba1 100644 (file)
@@ -1720,6 +1720,16 @@ SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number)
        return 20;
 }
 
+SWITCH_DECLARE(uint32_t) switch_default_rate(const char *name, uint32_t number)
+{
+
+       if (!strcasecmp(name, "opus")) {
+               return 48000;
+       }
+
+       return 8000;
+}
+
 static uint32_t d_30 = 30;
 
 static void switch_load_core_config(const char *file)
index 02a9e6792bf4ae8b754057690ea22088e4e6bca6..c1b37abbd1ffd01dde4406a5afa61aacb99a816e 100644 (file)
@@ -2165,7 +2165,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        }
                        
                        if (orate == 0) {
-                               orate = 8000;
+                               orate = switch_default_rate(name, 0);
                        }
 
                        switch_copy_string(jbuf, prefs[j], sizeof(jbuf));
@@ -2176,7 +2176,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        }
 
                        if (jrate == 0) {
-                               jrate = 8000;
+                               jrate = switch_default_rate(jname, 0);
                        }
 
                        if (!strcasecmp(name, jname) && ointerval == jinterval && orate == jrate) {
@@ -2188,6 +2188,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        /* If no specific codec interval is requested opt for the default above all else because lots of stuff assumes it */
                        for (imp = codec_interface->implementations; imp; imp = imp->next) {
                                uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
+                               uint32_t default_rate = switch_default_rate(imp->iananame, imp->ianacode);
                                
                                if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
                                        
@@ -2196,7 +2197,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                                                continue;
                                        }
 
-                                       if (((!rate && (uint32_t) imp->samples_per_second != 8000) || (rate && (uint32_t) imp->samples_per_second != rate))) {
+                                       if (((!rate && (uint32_t) imp->samples_per_second != default_rate) || (rate && (uint32_t) imp->samples_per_second != rate))) {
                                                continue;
                                        }