Added SDP support for stereo slin/alaw/mulaw.

git-svn-id: http://voip.null.ro/svn/yate@6483 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2021-04-19 10:02:58 +00:00
parent b3eaba2850
commit 98e943c8b8
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: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable ;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: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default ;mulaw=default
@ -107,6 +110,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient ; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no ;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] [hacks]
; This section holds the dirty stuff required to work with some broken ; 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: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable ;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: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default ;mulaw=default
@ -88,6 +91,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient ; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no ;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] [hacks]
; This section holds the dirty stuff required to work with some broken ; 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: bool: Enable all unlisted codecs by default if a transcoder exists
;default=enable ;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: bool: Companded-only G711 mu-law (PCMU/8000)
;mulaw=default ;mulaw=default
@ -473,6 +476,15 @@
; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient ; NOTE: RFC 4867 (and older 3267) specifies the default is bandwidth efficient
;amr_octet=no ;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] [methods]
; Use this section to allow server processing of various SIP methods by ; 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 }, { "alaw", 8 },
{ "gsm", 3 }, { "gsm", 3 },
{ "lpc10", 7 }, { "lpc10", 7 },
{ "2*slin", 10 },
{ "slin", 11 }, { "slin", 11 },
{ "g726", 2 }, { "g726", 2 },
{ "g722/16000", 9 }, { "g722/16000", 9 },
@ -64,6 +65,9 @@ const TokenDict SDPParser::s_payloads[] = {
{ "mpv", 32 }, { "mpv", 32 },
{ "mp2t", 33 }, { "mp2t", 33 },
{ "mp4v", 110 }, { "mp4v", 110 },
// Stereo
{ "2*mulaw", 117 },
{ "2*alaw", 118 },
{ 0, 0 }, { 0, 0 },
}; };
@ -73,6 +77,7 @@ const TokenDict SDPParser::s_rtpmap[] = {
{ "PCMA/8000", 8 }, { "PCMA/8000", 8 },
{ "GSM/8000", 3 }, { "GSM/8000", 3 },
{ "LPC/8000", 7 }, { "LPC/8000", 7 },
{ "L16/8000/2", 10 },
{ "L16/8000", 11 }, { "L16/8000", 11 },
{ "G726-32/8000", 2 }, { "G726-32/8000", 2 },
{ "G722/8000", 9 }, { "G722/8000", 9 },
@ -101,6 +106,9 @@ const TokenDict SDPParser::s_rtpmap[] = {
{ "MPV/90000", 32 }, { "MPV/90000", 32 },
{ "MP2T/90000", 33 }, { "MP2T/90000", 33 },
{ "MP4V-ES/90000", 110 }, { "MP4V-ES/90000", 110 },
// Stereo, dynamic payloads
{ "PCMU/8000/2", 117 },
{ "PCMA/8000/2", 118 },
{ 0, 0 }, { 0, 0 },
}; };
@ -469,13 +477,15 @@ void SDPParser::initialize(const NamedList* codecs, const NamedList* hacks, cons
if (hacks) if (hacks)
m_hacks.copyParams(*hacks); m_hacks.copyParams(*hacks);
bool defcodecs = m_codecs.getBoolValue("default",true); bool defcodecs = m_codecs.getBoolValue("default",true);
bool stereo = m_codecs.getBoolValue("default_stereo");
m_audioFormats = ""; m_audioFormats = "";
String audio = "audio"; String audio = "audio";
for (const TokenDict* dict = s_payloads; dict->token; dict++) { for (const TokenDict* dict = s_payloads; dict->token; dict++) {
DataFormat fmt(dict->token); DataFormat fmt(dict->token);
const FormatInfo* info = fmt.getInfo(); const FormatInfo* info = fmt.getInfo();
if (info && (audio == info->type)) { 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,","); m_audioFormats.append(fmt,",");
} }
} }