MT#55283 add L16 and G726 support

Change-Id: Id12bd895cc8ce99d6988360bedaff75fb0b5a362
pull/1938/head
Richard Fuchs 8 months ago
parent 58e45c26e0
commit 636c9f193f

@ -72,7 +72,7 @@ bool audio_player_setup(struct call_media *m, const rtp_payload_type *dst_pt,
// TODO: shortcut this to avoid the detour of avframe -> avpacket -> avframe (all in s16)
rtp_payload_type src_pt = {
.payload_type = -1,
.encoding = STR_CONST("PCM-S16LE"), // XXX support flp
.encoding = STR_CONST("X-L16"), // XXX support flp
.channels = dst_pt->channels,
.clock_rate = clockrate,
.ptime = ptime_ms,

@ -400,7 +400,7 @@ int t38_gateway_pair(struct call_media *t38_media, struct call_media *pcm_media,
tg->options = opts;
tg->pcm_pt.payload_type = -1;
tg->pcm_pt.encoding = STR("PCM-S16LE");
tg->pcm_pt.encoding = STR("X-L16");
tg->pcm_pt.encoding_with_params = tg->pcm_pt.encoding;
tg->pcm_pt.clock_rate = 8000;
tg->pcm_pt.channels = 1;

@ -771,14 +771,95 @@ static struct codec_def_s __codec_defs[] = {
.format_cmp = format_cmp_ignore,
.codec_type = &codec_type_cn,
},
// for file reading and writing
{
.rtpname = "PCM-S16LE",
.rtpname = "G726-16",
.avcodec_id = AV_CODEC_ID_ADPCM_G726,
.default_clockrate = 8000,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.default_bitrate = 16000,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
.dtx_methods = {
[DTX_SILENCE] = &dtx_method_silence,
[DTX_CN] = &dtx_method_cn,
},
},
{
.rtpname = "G726-24",
.avcodec_id = AV_CODEC_ID_ADPCM_G726,
.default_clockrate = 8000,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.default_bitrate = 24000,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
.dtx_methods = {
[DTX_SILENCE] = &dtx_method_silence,
[DTX_CN] = &dtx_method_cn,
},
},
{
.rtpname = "G726-32",
.avcodec_id = AV_CODEC_ID_ADPCM_G726,
.default_clockrate = 8000,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.default_bitrate = 32000,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
.dtx_methods = {
[DTX_SILENCE] = &dtx_method_silence,
[DTX_CN] = &dtx_method_cn,
},
},
{
.rtpname = "G726-40",
.avcodec_id = AV_CODEC_ID_ADPCM_G726,
.default_clockrate = 8000,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.default_bitrate = 40000,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
.dtx_methods = {
[DTX_SILENCE] = &dtx_method_silence,
[DTX_CN] = &dtx_method_cn,
},
},
{
.rtpname = "L16",
.avcodec_id = AV_CODEC_ID_PCM_S16BE,
.default_clockrate = 44100,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.bits_per_sample = 16,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
},
{
.rtpname = "X-L16",
.avcodec_id = AV_CODEC_ID_PCM_S16LE,
.default_clockrate = 44100,
.default_channels = 1,
.default_ptime = 20,
.minimum_ptime = 20,
.bits_per_sample = 16,
.packetizer = packetizer_passthrough,
.media_type = MT_AUDIO,
.codec_type = &codec_type_avcodec,
},
// for file reading and writing
{
.rtpname = "PCM-U8",
.avcodec_id = AV_CODEC_ID_PCM_U8,

@ -432,7 +432,7 @@ void output_init(const char *format) {
str codec;
if (!strcmp(format, "wav")) {
codec = STR("PCM-S16LE");
codec = STR("X-L16");
output_file_format = "wav";
}
else if (!strcmp(format, "mp3")) {

@ -84,6 +84,68 @@ sub stun_succ {
new_call;
offer('L16 default', { codec => { transcode => ['L16/44100'] } }, <<SDP);
v=0
o=- 1737366280 1737366280 IN IP4 192.168.40.21
s=Polycom IP Phone
c=IN IP4 192.168.40.21
t=0 0
m=audio 36806 RTP/AVP 9 8 101
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=rtcp:36807
-----------------------------------------------
v=0
o=- 1737366280 1737366280 IN IP4 192.168.40.21
s=Polycom IP Phone
t=0 0
m=audio PORT RTP/AVP 9 8 10 96 101
c=IN IP4 203.0.113.1
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:10 L16/44100
a=rtpmap:96 telephone-event/44100
a=fmtp:96 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
new_call;
offer('L16 non standard', { codec => { transcode => ['L16/16000'] } }, <<SDP);
v=0
o=- 1737366280 1737366280 IN IP4 192.168.40.21
s=Polycom IP Phone
c=IN IP4 192.168.40.21
t=0 0
m=audio 36806 RTP/AVP 9 8 101
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=rtcp:36807
-----------------------------------------------
v=0
o=- 1737366280 1737366280 IN IP4 192.168.40.21
s=Polycom IP Phone
t=0 0
m=audio PORT RTP/AVP 9 8 96 97 101
c=IN IP4 203.0.113.1
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 L16/16000
a=rtpmap:97 telephone-event/16000
a=fmtp:97 0-15
a=rtpmap:101 telephone-event/8000
a=sendrecv
a=rtcp:PORT
SDP
($sock_a, $sock_b) = new_call([qw(198.51.100.1 7124)], [qw(198.51.100.3 7126)]);
($port_a) = offer('wonky DTMF (GH#1929)', {

Loading…
Cancel
Save