Added SDP support for stereo slin/alaw/mulaw.

git-svn-id: http://yate.null.ro/svn/yate/trunk@6483 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2021-04-19 10:02:58 +00:00
parent 2014766be1
commit 0b8f9b48cc
4 changed files with 47 additions and 1 deletions

View File

@ -66,6 +66,9 @@
; default: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable
; default_stereo: bool: Enable all unlisted stereo audio codecs by default if a transcoder exists
;default_stereo=no
; mulaw: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default
@ -107,6 +110,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no
; 2*mulaw: bool: Stereo Companded-only G711 mu-law (PCMU/8000)
;2*mulaw=default_stereo
; 2*alaw: bool: Stereo Companded-only G711 a-law (PCMU/8000)
;2*alaw=default_stereo
; 2*slin: bool: Stereo Signed Linear 16-bit uncompressed (L16/8000)
;2*slin=default_stereo
[hacks]
; This section holds the dirty stuff required to work with some broken

View File

@ -47,6 +47,9 @@
; default: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable
; default_stereo: bool: Enable all unlisted stereo audio codecs by default if a transcoder exists
;default_stereo=no
; mulaw: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default
@ -88,6 +91,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no
; 2*mulaw: bool: Stereo Companded-only G711 mu-law (PCMU/8000)
;2*mulaw=default_stereo
; 2*alaw: bool: Stereo Companded-only G711 a-law (PCMU/8000)
;2*alaw=default_stereo
; 2*slin: bool: Stereo Signed Linear 16-bit uncompressed (L16/8000)
;2*slin=default_stereo
[hacks]
; This section holds the dirty stuff required to work with some broken

View File

@ -429,6 +429,9 @@
; default: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable
; default_stereo: bool: Enable all unlisted stereo audio codecs by default if a transcoder exists
;default_stereo=no
; mulaw: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default
@ -473,6 +476,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no
; 2*mulaw: bool: Stereo Companded-only G711 mu-law (PCMU/8000)
;2*mulaw=default_stereo
; 2*alaw: bool: Stereo Companded-only G711 a-law (PCMU/8000)
;2*alaw=default_stereo
; 2*slin: bool: Stereo Signed Linear 16-bit uncompressed (L16/8000)
;2*slin=default_stereo
[methods]
; Use this section to allow server processing of various SIP methods by

View File

@ -32,6 +32,7 @@ const TokenDict SDPParser::s_payloads[] = {
{ "alaw", 8 },
{ "gsm", 3 },
{ "lpc10", 7 },
{ "2*slin", 10 },
{ "slin", 11 },
{ "g726", 2 },
{ "g722/16000", 9 },
@ -64,6 +65,9 @@ const TokenDict SDPParser::s_payloads[] = {
{ "mpv", 32 },
{ "mp2t", 33 },
{ "mp4v", 110 },
// Stereo
{ "2*mulaw", 117 },
{ "2*alaw", 118 },
{ 0, 0 },
};
@ -73,6 +77,7 @@ const TokenDict SDPParser::s_rtpmap[] = {
{ "PCMA/8000", 8 },
{ "GSM/8000", 3 },
{ "LPC/8000", 7 },
{ "L16/8000/2", 10 },
{ "L16/8000", 11 },
{ "G726-32/8000", 2 },
{ "G722/8000", 9 },
@ -101,6 +106,9 @@ const TokenDict SDPParser::s_rtpmap[] = {
{ "MPV/90000", 32 },
{ "MP2T/90000", 33 },
{ "MP4V-ES/90000", 110 },
// Stereo, dynamic payloads
{ "PCMU/8000/2", 117 },
{ "PCMA/8000/2", 118 },
{ 0, 0 },
};
@ -469,13 +477,15 @@ void SDPParser::initialize(const NamedList* codecs, const NamedList* hacks, cons
if (hacks)
m_hacks.copyParams(*hacks);
bool defcodecs = m_codecs.getBoolValue("default",true);
bool stereo = m_codecs.getBoolValue("default_stereo");
m_audioFormats = "";
String audio = "audio";
for (const TokenDict* dict = s_payloads; dict->token; dict++) {
DataFormat fmt(dict->token);
const FormatInfo* info = fmt.getInfo();
if (info && (audio == info->type)) {
if (m_codecs.getBoolValue(fmt,defcodecs && DataTranslator::canConvert(fmt)))
bool defVal = (2 != info->numChannels) ? defcodecs : stereo;
if (m_codecs.getBoolValue(fmt,defVal && DataTranslator::canConvert(fmt)))
m_audioFormats.append(fmt,",");
}
}