summaryrefslogtreecommitdiff
path: root/rtp.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-04-10 15:36:52 +0000
committerMark Spencer <markster@digium.com>2003-04-10 15:36:52 +0000
commit926b8041a1c3f2824e9a0990e3ed3eca46e0262d (patch)
tree8f715e81999329f98d17edb9213367bf642e2cfd /rtp.c
parent70daa486aaa7f0a8d8d38eced8f490128d8ed596 (diff)
Use a static outbound list for transmitting RTP, and the dynamic only for inbound
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@812 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'rtp.c')
-rwxr-xr-xrtp.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/rtp.c b/rtp.c
index af65250cd..57a4854e0 100755
--- a/rtp.c
+++ b/rtp.c
@@ -70,11 +70,11 @@ struct ast_rtp {
struct io_context *io;
void *data;
ast_rtp_callback callback;
- struct rtpPayloadType current_RTP_PT[MAX_RTP_PT];
- // a cache for the result of rtp_lookup_code():
- int rtp_lookup_code_cache_isAstFormat;
- int rtp_lookup_code_cache_code;
- int rtp_lookup_code_cache_result;
+ struct rtpPayloadType current_RTP_PT[MAX_RTP_PT];
+ // a cache for the result of rtp_lookup_code():
+ int rtp_lookup_code_cache_isAstFormat;
+ int rtp_lookup_code_cache_code;
+ int rtp_lookup_code_cache_result;
};
static struct ast_rtp_protocol *protos = NULL;
@@ -378,7 +378,9 @@ static struct {
{{1, AST_FORMAT_H263}, "video", "H263"},
};
-// Static (i.e., well-known) RTP payload types for our "AST_FORMAT..."s:
+/* Static (i.e., well-known) RTP payload types for our "AST_FORMAT..."s:
+ also, our own choices for dynamic payload types. This is our master
+ table for transmission */
static struct rtpPayloadType static_RTP_PT[MAX_RTP_PT] = {
[0] = {1, AST_FORMAT_ULAW},
[3] = {1, AST_FORMAT_GSM},
@@ -398,6 +400,7 @@ static struct rtpPayloadType static_RTP_PT[MAX_RTP_PT] = {
[31] = {1, AST_FORMAT_H261},
[34] = {1, AST_FORMAT_H263},
[101] = {0, AST_RTP_DTMF},
+ [110] = {1, AST_FORMAT_SPEEX},
};
void ast_rtp_pt_clear(struct ast_rtp* rtp)
@@ -484,6 +487,8 @@ struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) {
int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) {
int pt;
+ /* Looks up an RTP code out of our *static* outbound list */
+
if (isAstFormat == rtp->rtp_lookup_code_cache_isAstFormat &&
code == rtp->rtp_lookup_code_cache_code) {
// Use our cached mapping, to avoid the overhead of the loop below
@@ -491,8 +496,8 @@ int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) {
}
for (pt = 0; pt < MAX_RTP_PT; ++pt) {
- if (rtp->current_RTP_PT[pt].code == code &&
- rtp->current_RTP_PT[pt].isAstFormat == isAstFormat) {
+ if (static_RTP_PT[pt].code == code &&
+ static_RTP_PT[pt].isAstFormat == isAstFormat) {
rtp->rtp_lookup_code_cache_isAstFormat = isAstFormat;
rtp->rtp_lookup_code_cache_code = code;
rtp->rtp_lookup_code_cache_result = pt;