[commit] r11534 - freeswitch/trunk/src/mod/endpoints/mod_opal
Author: robertj Date: Tue Jan 27 21:12:36 2009 New Revision: 11534 Log: Removed the construction of new OpalMediaFormat instances from FS codecs, need for H.323 capabilities makes this impossible, OPAL must know about the codec a priori (and how to make H.323 capability from it) or it cannot be used. Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp (original) +++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.cpp Tue Jan 27 21:12:36 2009 @@ -351,6 +351,21 @@ AddRouteEntry("iax2:.* = local:<da>"); // config option for direct routing AddRouteEntry("local:.* = h323:<da>"); // config option for direct routing + // Make sure all known codecs are instantiated, + // these are ones we know how to translate into H.323 capabilities + GetOpalG728(); + GetOpalG729(); + GetOpalG729A(); + GetOpalG729B(); + GetOpalG729AB(); + GetOpalG7231_6k3(); + GetOpalG7231_5k3(); + GetOpalG7231A_6k3(); + GetOpalG7231A_5k3(); + GetOpalGSM0610(); + GetOpalGSMAMR(); + GetOpaliLBC(); + /* For compatibility with the algorithm in FSConnection::SetCodecs() we need to set all audio media formats to be 1 frame per packet */ OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats(); @@ -469,49 +484,6 @@ } -bool FSEndPoint::AddMediaFormat(const switch_codec_implementation_t *codec) -{ - OpalMediaType mediaType; - - switch (codec->codec_type) { - case SWITCH_CODEC_TYPE_AUDIO: - mediaType = OpalMediaType::Audio(); - break; - - case SWITCH_CODEC_TYPE_VIDEO: - mediaType = OpalMediaType::Video(); - break; - - case SWITCH_CODEC_TYPE_T38: - mediaType = OpalMediaType::Fax(); - break; - - default: - return false; - } - - OpalMediaFormat * newMediaFormat = new OpalMediaFormat(codec->iananame, - mediaType, - (RTP_DataFrame::PayloadTypes) codec->ianacode, - codec->iananame, - codec->codec_type == SWITCH_CODEC_TYPE_AUDIO, - codec->bits_per_second, - codec->encoded_bytes_per_packet, - codec->samples_per_packet, - codec->samples_per_second); - if (newMediaFormat == NULL || !newMediaFormat->IsValid()) { - return false; - } - - // Save pointer so will auto delete allocated objects on destruction. - m_globalMediaFormats.Append(newMediaFormat); - - PTRACE(2, "mod_opal\tNew OPAL media format created for FS codec: iananame=" << codec->iananame - << ", ianacode=" << codec->ianacode << ", rate=" << codec->samples_per_second); - return true; -} - - /////////////////////////////////////////////////////////////////////// FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint) @@ -680,11 +652,8 @@ // See if we have a match by name alone switchFormat = codec->iananame; if (!switchFormat.IsValid()) { - // Add the new name to OPAL's global lists - if (m_endpoint.AddMediaFormat(codec)) { - // Now we finally have it - switchFormat = codec->iananame; - } + PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format."); + continue; } } Modified: freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h ============================================================================== --- freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h (original) +++ freeswitch/trunk/src/mod/endpoints/mod_opal/mod_opal.h Tue Jan 27 21:12:36 2009 @@ -114,11 +114,6 @@ virtual bool OnIncomingCall(OpalLocalConnection &); virtual OpalLocalConnection *CreateConnection(OpalCall &, void *); - - bool AddMediaFormat(const switch_codec_implementation_t *codec); - - private: - PList<OpalMediaFormat> m_globalMediaFormats; };
participants (1)
-
FreeSWITCH SVN