[Asterisk-cvs] asterisk rtp.c,1.60,1.61

markster at lists.digium.com markster at lists.digium.com
Mon Mar 22 16:56:09 CST 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv6480

Modified Files:
	rtp.c 
Log Message:
Use caller's negotiated values when possible.


Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- rtp.c	20 Mar 2004 05:22:52 -0000	1.60
+++ rtp.c	22 Mar 2004 21:52:22 -0000	1.61
@@ -663,14 +663,19 @@
   }
 }
 
-struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) {
+struct rtpPayloadType ast_rtp_lookup_pt(struct ast_rtp* rtp, int pt) 
+{
+  struct rtpPayloadType result;
   if (pt < 0 || pt > MAX_RTP_PT) {
-    struct rtpPayloadType result;
     result.isAstFormat = result.code = 0;
     return result; // bogus payload type
   }
-  /* Gotta use our static one, since that's what we sent against */
-  return static_RTP_PT[pt];
+  /* Start with the negotiated codecs */
+  result = rtp->current_RTP_PT[pt];
+  /* If it doesn't exist, check our static RTP type list, just in case */
+  if (!result.code) 
+  	result = static_RTP_PT[pt];
+  return result;
 }
 
 int ast_rtp_lookup_code(struct ast_rtp* rtp, int isAstFormat, int code) {
@@ -684,6 +689,18 @@
     return rtp->rtp_lookup_code_cache_result;
   }
 
+	/* Check the dynamic list first */
+  for (pt = 0; pt < MAX_RTP_PT; ++pt) {
+    if (rtp->current_RTP_PT[pt].code == code &&
+		rtp->current_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;
+      return pt;
+    }
+  }
+
+	/* Then the static list */
   for (pt = 0; pt < MAX_RTP_PT; ++pt) {
     if (static_RTP_PT[pt].code == code &&
 		static_RTP_PT[pt].isAstFormat == isAstFormat) {




More information about the svn-commits mailing list