mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-23 04:14:47 +00:00
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.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11534 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a6328e287a
commit
f2055745eb
@ -351,6 +351,21 @@ bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
|
|||||||
AddRouteEntry("iax2:.* = local:<da>"); // config option for direct routing
|
AddRouteEntry("iax2:.* = local:<da>"); // config option for direct routing
|
||||||
AddRouteEntry("local:.* = h323:<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
|
/* For compatibility with the algorithm in FSConnection::SetCodecs() we need
|
||||||
to set all audio media formats to be 1 frame per packet */
|
to set all audio media formats to be 1 frame per packet */
|
||||||
OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();
|
OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();
|
||||||
@ -469,49 +484,6 @@ OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)
|
FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint)
|
||||||
@ -680,11 +652,8 @@ void FSConnection::SetCodecs()
|
|||||||
// See if we have a match by name alone
|
// See if we have a match by name alone
|
||||||
switchFormat = codec->iananame;
|
switchFormat = codec->iananame;
|
||||||
if (!switchFormat.IsValid()) {
|
if (!switchFormat.IsValid()) {
|
||||||
// Add the new name to OPAL's global lists
|
PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format.");
|
||||||
if (m_endpoint.AddMediaFormat(codec)) {
|
continue;
|
||||||
// Now we finally have it
|
|
||||||
switchFormat = codec->iananame;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +114,6 @@ class FSEndPoint:public OpalLocalEndPoint {
|
|||||||
|
|
||||||
virtual bool OnIncomingCall(OpalLocalConnection &);
|
virtual bool OnIncomingCall(OpalLocalConnection &);
|
||||||
virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
|
virtual OpalLocalConnection *CreateConnection(OpalCall &, void *);
|
||||||
|
|
||||||
bool AddMediaFormat(const switch_codec_implementation_t *codec);
|
|
||||||
|
|
||||||
private:
|
|
||||||
PList<OpalMediaFormat> m_globalMediaFormats;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user