summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrédéric Brière <fbriere@fbriere.net>2020-03-30 18:19:35 -0400
committerFrédéric Brière <fbriere@fbriere.net>2020-03-30 19:15:31 -0400
commitae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb (patch)
tree57f6c7b8a1296e4cbbf365b27cb451934c9c7180 /src
parentaaa3593b1e1f1c43ccb62028071842e376341c5e (diff)
downloadtwinkle-ae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb.tar
twinkle-ae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb.tar.gz
twinkle-ae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb.tar.lz
twinkle-ae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb.tar.xz
twinkle-ae62caebc6769f96d7ffc2e7e4f4e6e07ec0f0fb.zip
Use the first payload type number for each codec in the SDP answer
It is possible for the SDP offer to feature more than one payload type number (either static or dynamic) that refer to the same codec. For example, a peer that supports ITU-T V.152 may use two payload types, with one of them marked for voice-band data use: m=audio 3456 RTP/AVP 0 98 a=rtpmap:0 PCMU/8000 a=rtpmap:98 PCMU/8000 a=gpmd:98 vbd=yes Ideally, Twinkle should use the number that was listed first in the media formats list when building the SDP answer. Closes #184
Diffstat (limited to 'src')
-rw-r--r--src/session.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/session.cpp b/src/session.cpp
index ae816fa..2007791 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -44,7 +44,10 @@ void t_session::set_recvd_codecs(t_sdp *sdp) {
t_audio_codec ac = sdp->get_codec(SDP_AUDIO, *i);
if (ac > CODEC_UNSUPPORTED) {
recvd_codecs.push_back(ac);
- send_ac2payload[ac] = *i;
+ // Don't overwrite any previous mapping for this codec
+ if (!send_ac2payload.count(ac)) {
+ send_ac2payload[ac] = *i;
+ }
send_payload2ac[*i] = ac;
}
}