]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Removed the construction of new OpalMediaFormat instances from FS codecs, need for...
authorRobert Joly <rjoly@nortel.com>
Wed, 28 Jan 2009 03:12:36 +0000 (03:12 +0000)
committerRobert Joly <rjoly@nortel.com>
Wed, 28 Jan 2009 03:12:36 +0000 (03:12 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11534 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_opal/mod_opal.cpp
src/mod/endpoints/mod_opal/mod_opal.h

index 8aad7c7757284987fa467067870c0d4366bce6d6..f4b188bbfa552d6885dd46e49eb5796c3a3f342e 100644 (file)
@@ -351,6 +351,21 @@ bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
     AddRouteEntry("iax2:.* = local:<da>");  // config option for direct routing\r
     AddRouteEntry("local:.* = h323:<da>");  // config option for direct routing\r
 \r
+    // Make sure all known codecs are instantiated,\r
+    // these are ones we know how to translate into H.323 capabilities\r
+    GetOpalG728();\r
+    GetOpalG729();\r
+    GetOpalG729A();\r
+    GetOpalG729B();\r
+    GetOpalG729AB();\r
+    GetOpalG7231_6k3();\r
+    GetOpalG7231_5k3();\r
+    GetOpalG7231A_6k3();\r
+    GetOpalG7231A_5k3();\r
+    GetOpalGSM0610();\r
+    GetOpalGSMAMR();\r
+    GetOpaliLBC();\r
+\r
     /* For compatibility with the algorithm in FSConnection::SetCodecs() we need\r
        to set all audio media formats to be 1 frame per packet */\r
     OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();\r
@@ -469,49 +484,6 @@ OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userDat
 }\r
 \r
 \r
-bool FSEndPoint::AddMediaFormat(const switch_codec_implementation_t *codec)\r
-{\r
-    OpalMediaType mediaType;\r
-\r
-    switch (codec->codec_type) {\r
-      case SWITCH_CODEC_TYPE_AUDIO:\r
-        mediaType = OpalMediaType::Audio();\r
-        break;\r
-\r
-      case SWITCH_CODEC_TYPE_VIDEO:\r
-        mediaType = OpalMediaType::Video();\r
-        break;\r
-\r
-      case SWITCH_CODEC_TYPE_T38:\r
-        mediaType = OpalMediaType::Fax();\r
-        break;\r
-\r
-      default:\r
-        return false;\r
-    }\r
-\r
-    OpalMediaFormat * newMediaFormat = new OpalMediaFormat(codec->iananame,\r
-                                                           mediaType,\r
-                                                           (RTP_DataFrame::PayloadTypes) codec->ianacode,\r
-                                                           codec->iananame,\r
-                                                           codec->codec_type == SWITCH_CODEC_TYPE_AUDIO,\r
-                                                           codec->bits_per_second,\r
-                                                           codec->encoded_bytes_per_packet,\r
-                                                           codec->samples_per_packet,\r
-                                                           codec->samples_per_second);\r
-    if (newMediaFormat == NULL || !newMediaFormat->IsValid()) {\r
-        return false;\r
-    }\r
-\r
-    // Save pointer so will auto delete allocated objects on destruction.\r
-    m_globalMediaFormats.Append(newMediaFormat);\r
-\r
-    PTRACE(2, "mod_opal\tNew OPAL media format created for FS codec: iananame=" << codec->iananame\r
-           << ", ianacode=" << codec->ianacode << ", rate=" << codec->samples_per_second);\r
-    return true;\r
-}\r
-\r
-\r
 ///////////////////////////////////////////////////////////////////////\r
 \r
 FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)\r
@@ -680,11 +652,8 @@ void FSConnection::SetCodecs()
             // See if we have a match by name alone\r
             switchFormat = codec->iananame;\r
             if (!switchFormat.IsValid()) {\r
-                // Add the new name to OPAL's global lists\r
-                if (m_endpoint.AddMediaFormat(codec)) {\r
-                    // Now we finally have it\r
-                    switchFormat = codec->iananame;\r
-                }\r
+              PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format.");\r
+              continue;\r
             }\r
         }\r
         \r
index d4a096c680e15a80682d06241bc1b55b65d6ba21..fc9d91b7fb14bf7f1b7826f4468cbd75290cb259 100644 (file)
@@ -114,11 +114,6 @@ class FSEndPoint:public OpalLocalEndPoint {
 
     virtual bool OnIncomingCall(OpalLocalConnection &);
     virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
-
-    bool AddMediaFormat(const switch_codec_implementation_t *codec);
-
-  private:
-    PList<OpalMediaFormat> m_globalMediaFormats;
 };