[asterisk-commits] rizzo: branch rizzo/astobj2 r47424 -
/team/rizzo/astobj2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Nov 10 08:08:17 MST 2006
Author: rizzo
Date: Fri Nov 10 09:08:17 2006
New Revision: 47424
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47424
Log:
merge version 47337, g722 sample rates
Modified:
team/rizzo/astobj2/channels/chan_sip.c
Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47424&r1=47423&r2=47424
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Nov 10 09:08:17 2006
@@ -6274,6 +6274,8 @@
}
+#define SDP_SAMPLE_RATE(x) (x == AST_FORMAT_G722) ? 16000 : 8000
+
/*! \brief Add Session Description Protocol message */
static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p)
{
@@ -6398,31 +6400,33 @@
Note that p->prefcodec can include video codecs, so mask them out
*/
if (capability & p->prefcodec) {
- add_codec_to_sdp(p, p->prefcodec & AST_FORMAT_AUDIO_MASK, 8000,
+ int codec = p->prefcodec & AST_FORMAT_AUDIO_MASK;
+
+ add_codec_to_sdp(p, codec, SDP_SAMPLE_RATE(codec),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);
- alreadysent |= p->prefcodec & AST_FORMAT_AUDIO_MASK;
+ alreadysent |= codec;
}
/* Start by sending our preferred audio codecs */
for (x = 0; x < 32; x++) {
- int pref_codec;
-
- if (!(pref_codec = ast_codec_pref_index(&p->prefs, x)))
+ int codec;
+
+ if (!(codec = ast_codec_pref_index(&p->prefs, x)))
break;
- if (!(capability & pref_codec))
+ if (!(capability & codec))
continue;
- if (alreadysent & pref_codec)
+ if (alreadysent & codec)
continue;
- add_codec_to_sdp(p, pref_codec, 8000,
+ add_codec_to_sdp(p, codec, SDP_SAMPLE_RATE(codec),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);
- alreadysent |= pref_codec;
+ alreadysent |= codec;
}
/* Now send any other common audio and video codecs, and non-codec formats: */
@@ -6434,7 +6438,7 @@
continue;
if (x <= AST_FORMAT_MAX_AUDIO)
- add_codec_to_sdp(p, x, 8000,
+ add_codec_to_sdp(p, x, SDP_SAMPLE_RATE(x),
&m_audio_next, &m_audio_left,
&a_audio_next, &a_audio_left,
debug, &min_audio_packet_size);
More information about the asterisk-commits
mailing list