[asterisk-commits] file: branch file/rtp_engine-mark2 r185776 - in /team/file/rtp_engine-mark2: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 1 08:58:17 CDT 2009


Author: file
Date: Wed Apr  1 08:58:13 2009
New Revision: 185776

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185776
Log:
Address some more comments from Russell.

Modified:
    team/file/rtp_engine-mark2/channels/chan_sip.c
    team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
    team/file/rtp_engine-mark2/main/rtp_engine.c

Modified: team/file/rtp_engine-mark2/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/channels/chan_sip.c?view=diff&rev=185776&r1=185775&r2=185776
==============================================================================
--- team/file/rtp_engine-mark2/channels/chan_sip.c (original)
+++ team/file/rtp_engine-mark2/channels/chan_sip.c Wed Apr  1 08:58:13 2009
@@ -7846,7 +7846,7 @@
 				/* Note: should really look at the '#chans' params too */
 				/* Note: This should all be done in the context of the m= above */
 				if (!strncasecmp(mimeSubtype, "H26", 3) || !strncasecmp(mimeSubtype, "MP4", 3)) {         /* Video */
-					if(ast_rtp_codecs_payloads_set_rtpmap_type_rate(&newvideortp, NULL, codec, "video", mimeSubtype, 0, sample_rate) != -1) {
+					if (ast_rtp_codecs_payloads_set_rtpmap_type_rate(&newvideortp, NULL, codec, "video", mimeSubtype, 0, sample_rate) != -1) {
 						if (debug)
 							ast_verbose("Found video description format %s for ID %d\n", mimeSubtype, codec);
 						found_rtpmap_codecs[last_rtpmap_codec] = codec;
@@ -7871,7 +7871,7 @@
 							ast_verbose("RED submimetype has payload type: %d\n", red_pt);
 					}
 				} else {                                          /* Must be audio?? */
-					if(ast_rtp_codecs_payloads_set_rtpmap_type_rate(&newaudiortp, NULL, codec, "audio", mimeSubtype,
+					if (ast_rtp_codecs_payloads_set_rtpmap_type_rate(&newaudiortp, NULL, codec, "audio", mimeSubtype,
 											ast_test_flag(&p->flags[0], SIP_G726_NONSTANDARD) ? AST_RTP_OPT_G726_NONSTANDARD : 0, sample_rate) != -1) {
 						if (debug)
 							ast_verbose("Found audio description format %s for ID %d\n", mimeSubtype, codec);
@@ -8024,8 +8024,7 @@
 	newjointcapability = p->capability & (peercapability | vpeercapability | tpeercapability);
 	newpeercapability = (peercapability | vpeercapability | tpeercapability);
 	newnoncodeccapability = p->noncodeccapability & peernoncodeccapability;
-		
-		
+
 	if (debug) {
 		/* shame on whoever coded this.... */
 		char s1[SIPBUFSIZE], s2[SIPBUFSIZE], s3[SIPBUFSIZE], s4[SIPBUFSIZE], s5[SIPBUFSIZE];
@@ -8036,11 +8035,17 @@
 			    ast_getformatname_multiple(s3, SIPBUFSIZE, vpeercapability),
 			    ast_getformatname_multiple(s4, SIPBUFSIZE, tpeercapability),
 			    ast_getformatname_multiple(s5, SIPBUFSIZE, newjointcapability));
+	}
+
+	if (debug) {
+		struct ast_str *s1 = ast_str_alloca(SIPBUFSIZE);
+		struct ast_str *s2 = ast_str_alloca(SIPBUFSIZE);
+		struct ast_str *s3 = ast_str_alloca(SIPBUFSIZE);
 
 		ast_verbose("Non-codec capabilities (dtmf): us - %s, peer - %s, combined - %s\n",
-			    ast_rtp_lookup_mime_multiple2(s1, SIPBUFSIZE, p->noncodeccapability, 0, 0),
-			    ast_rtp_lookup_mime_multiple2(s2, SIPBUFSIZE, peernoncodeccapability, 0, 0),
-			    ast_rtp_lookup_mime_multiple2(s3, SIPBUFSIZE, newnoncodeccapability, 0, 0));
+			    ast_rtp_lookup_mime_multiple2(s1, p->noncodeccapability, 0, 0),
+			    ast_rtp_lookup_mime_multiple2(s2, peernoncodeccapability, 0, 0),
+			    ast_rtp_lookup_mime_multiple2(s3, newnoncodeccapability, 0, 0));
 	}
 	if (!newjointcapability) {
 		/* If T.38 was not negotiated either, totally bail out... */

Modified: team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h?view=diff&rev=185776&r1=185775&r2=185776
==============================================================================
--- team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h (original)
+++ team/file/rtp_engine-mark2/include/asterisk/rtp_engine.h Wed Apr  1 08:58:13 2009
@@ -318,7 +318,7 @@
 	/*! Callback for setting an RTP property */
 	void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
 	/*! Callback for setting a payload */
-	void (*payload_set)(struct ast_rtp_instance *instance, int payload, int AstFormat, int format);
+	void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, int format);
 	/*! Callback for setting packetization preferences */
 	void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
 	/*! Callback for setting the remote address that RTP is to be sent to */
@@ -417,6 +417,8 @@
  *
  * \note It is recommended that you use the ast_rtp_engine_register macro so that the module is
  *       associated with the RTP engine and use counting is performed.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module);
 
@@ -436,6 +438,8 @@
  *
  * This unregisters the RTP engine declared as example_rtp_engine from the RTP engine core. If a module
  * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_engine_unregister(struct ast_rtp_engine *engine);
 
@@ -461,6 +465,8 @@
  *
  * \note It is recommended that you use the ast_rtp_glue_register macro so that the module is
  *       associated with the RTP glue and use counting is performed.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module);
 
@@ -480,6 +486,8 @@
  *
  * This unregisters the RTP glue declared as example_rtp_gkue from the RTP engine core. If a module
  * reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_glue_unregister(struct ast_rtp_glue *glue);
 
@@ -506,6 +514,8 @@
  *
  * \note The RTP engine does not have to use the address provided when creating an RTP instance. It may choose to use
  *       another depending on it's own configuration.
+ *
+ * \since 1.6.3
  */
 struct ast_rtp_instance *ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, struct sockaddr_in *sin, void *data);
 
@@ -525,6 +535,8 @@
  *
  * This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid
  * memory and may not be used again.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_destroy(struct ast_rtp_instance *instance);
 
@@ -542,6 +554,8 @@
  *
  * This sets the data pointer on the RTP instance pointed to by 'instance' to
  * blob.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data);
 
@@ -557,6 +571,8 @@
  ( \endcode
  *
  * This gets the data pointer on the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
  */
 void *ast_rtp_instance_get_data(struct ast_rtp_instance *instance);
 
@@ -576,6 +592,8 @@
  *
  * This gives the frame pointed to by frame to the RTP engine being used for the instance
  * and asks that it be transmitted to the current remote address set on the RTP instance.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame);
 
@@ -596,6 +614,8 @@
  * \endcode
  *
  * This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
+ *
+ * \since 1.6.3
  */
 struct ast_frame *ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp);
 
@@ -616,6 +636,8 @@
  *
  * This changes the remote address that RTP will be sent to on instance to the address given in the sin
  * structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
 
@@ -636,6 +658,8 @@
  *
  * This changes the local address that RTP is expected on to the address given in the sin
  * structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
 
@@ -656,6 +680,8 @@
  * \endcode
  *
  * This gets the local address that we are expecting RTP on and stores it in the 'sin' structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
 
@@ -677,6 +703,8 @@
  *
  * This retrieves the current remote address set on the instance pointed to by instance and puts the value
  * into the sin structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct sockaddr_in *address);
 
@@ -687,6 +715,7 @@
  * \param property The extended property to set
  * \param value The value to set the extended property to
  *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value);
 
@@ -696,6 +725,7 @@
  * \param instance The RTP instance to get the extended property on
  * \param property The extended property to get
  *
+ * \since 1.6.3
  */
 void *ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property);
 
@@ -713,6 +743,8 @@
  * \endcode
  *
  * This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
 
@@ -731,6 +763,8 @@
  * \endcode
  *
  * This returns the current value of the NAT property on the instance pointed to by instance.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property);
 
@@ -746,6 +780,8 @@
  * \endcode
  *
  * This gets the codecs structure on the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
  */
 struct ast_rtp_codecs *ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance);
 
@@ -763,6 +799,8 @@
  * \endcode
  *
  * This clears the codecs structure and puts it into a pristine state.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
 
@@ -780,6 +818,8 @@
  * \endcode
  *
  * This sets the default payloads on the codecs structure.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance);
 
@@ -797,6 +837,8 @@
  * \endcode
  *
  * This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance);
 
@@ -814,6 +856,8 @@
  * \endcode
  *
  * This records that the numerical payload '0' was seen in the codecs structure.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
 
@@ -837,6 +881,8 @@
  * \endcode
  *
  * This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimeType, char *mimeSubtype, enum ast_rtp_options options);
 
@@ -857,6 +903,8 @@
  * \retval 0 on success
  * \retval -1 if the payload type is out of range
  * \retval -2 if the mimeType/mimeSubtype combination was not found
+ *
+ * \since 1.6.3
  */
 int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt,
 				  char *mimeType, char *mimeSubtype,
@@ -877,6 +925,8 @@
  * \endcode
  *
  * This clears the payload '0' from the codecs structure. It will be as if it was never set.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload);
 
@@ -896,6 +946,8 @@
  * \endcode
  *
  * This looks up the information for payload '0' from the codecs structure.
+ *
+ * \since 1.6.3
  */
 struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload);
 
@@ -906,6 +958,8 @@
  * \param code Format code, either from AST_FORMAT list or from AST_RTP list
  *
  * \return the sample rate if the format was found, zero if it was not found
+ *
+ * \since 1.6.3
  */
 unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
 
@@ -913,20 +967,22 @@
  * \brief Retrieve all formats that were found
  *
  * \param codecs Codecs structure to look in
- * \param AstFormats An integer to put the Asterisk formats in
- * \param nonAstFormats An integer to put the non-Asterisk formats in
- *
- * Example usage:
- *
- * \code
- * int AstFormats, nonAstFormats;
- * ast_rtp_codecs_payload_Formats(&codecs, &AstFormats, &nonAstFormats);
+ * \param astFormats An integer to put the Asterisk formats in
+ * \param nonastformats An integer to put the non-Asterisk formats in
+ *
+ * Example usage:
+ *
+ * \code
+ * int astformats, nonastformats;
+ * ast_rtp_codecs_payload_Formats(&codecs, &astformats, &nonastformats);
  * \endcode
  *
  * This retrieves all the formats known about in the codecs structure and puts the Asterisk ones in the integer
- * pointed to by AstFormats and the non-Asterisk ones in the integer pointed to by nonAstFormats.
- */
-void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *AstFormats, int *nonAstFormats);
+ * pointed to by astformats and the non-Asterisk ones in the integer pointed to by nonastformats.
+ *
+ * \since 1.6.3
+ */
+void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astformats, int *nonastformats);
 
 /*!
  * \brief Retrieve a payload based on whether it is an Asterisk format and the code
@@ -944,6 +1000,8 @@
  * \endcode
  *
  * This looks for the numerical payload for ULAW in the codecs structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code);
 
@@ -964,6 +1022,8 @@
  * \endcode
  *
  * This looks up the mime subtype for the ULAW format.
+ *
+ * \since 1.6.3
  */
 const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options);
 
@@ -971,7 +1031,6 @@
  * \brief Convert formats into a string and put them into a buffer
  *
  * \param buf Buffer to put the mime output into
- * \param size Size of the above buffer
  * \param capability Formats that we are looking up
  * \param asterisk_format Non-zero if the given capability are Asterisk format capabilities
  * \param options Additional options that may change the result
@@ -987,8 +1046,10 @@
  * \endcode
  *
  * This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
- */
-char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int asterisk_format, enum ast_rtp_options options);
+ *
+ * \since 1.6.3
+ */
+char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const int capability, const int asterisk_format, enum ast_rtp_options options);
 
 /*!
  * \brief Set codec packetization preferences
@@ -1004,6 +1065,8 @@
  * \endcode
  *
  * This sets the packetization preferences pointed to by prefs on the codecs structure pointed to by codecs.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs);
 
@@ -1024,6 +1087,8 @@
  *
  * This starts sending the DTMF '1' on the RTP instance pointed to by instance. It will
  * continue being sent until it is ended.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit);
 
@@ -1043,6 +1108,8 @@
  * \endcode
  *
  * This stops sending the DTMF '1' on the RTP instance pointed to by instance.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit);
 
@@ -1062,6 +1129,8 @@
  * \endcode
  *
  * This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode);
 
@@ -1079,6 +1148,8 @@
  * \endcode
  *
  * This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
  */
 enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance);
 
@@ -1095,6 +1166,8 @@
  *
  * This indicates that a new source of media is feeding the instance pointed to by
  * instance.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_new_source(struct ast_rtp_instance *instance);
 
@@ -1116,6 +1189,8 @@
  * \endcode
  *
  * This sets the TOS and COS values to 0 on the instance pointed to by instance.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc);
 
@@ -1132,6 +1207,8 @@
  *
  * This tells the RTP engine being used for the instance pointed to by instance
  * that media is no longer going to it at this time, but may in the future.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_stop(struct ast_rtp_instance *instance);
 
@@ -1152,6 +1229,8 @@
  *
  * This retrieves the file descriptor for the socket carrying media on the instance
  * pointed to by instance.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp);
 
@@ -1170,6 +1249,8 @@
  * \endcode
  *
  * This retrieves the RTP glue that has the name 'Example'.
+ *
+ * \since 1.6.3
  */
 struct ast_rtp_glue *ast_rtp_instance_get_glue(const char *type);
 
@@ -1186,6 +1267,8 @@
  * \retval Bridge result
  *
  * \note This should only be used by channel drivers in their technology declaration.
+ *
+ * \since 1.6.3
  */
 enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms);
 
@@ -1204,6 +1287,8 @@
  * \endcode
  *
  * This gets the RTP instance that instance0 is bridged to.
+ *
+ * \since 1.6.3
  */
 struct ast_rtp_instance *ast_rtp_instance_get_bridged(struct ast_rtp_instance *instance);
 
@@ -1213,6 +1298,7 @@
  * \param c0 First channel part of the bridge
  * \param c1 Second channel part of the bridge
  *
+ * \since 1.6.3
  */
 void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c0, struct ast_channel *c1);
 
@@ -1226,6 +1312,8 @@
  * \retval -1 failure
  *
  * \note This should only be used by channel drivers in their technology declaration.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1);
 
@@ -1239,6 +1327,8 @@
  *
  * \retval 0 success
  * \retval -1 failure
+ *
+ * \since 1.6.3
  */
 int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations);
 
@@ -1250,6 +1340,8 @@
  *
  * \retval 0 success
  * \retval -1 failure
+ *
+ * \since 1.6.3
  */
 int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame);
 
@@ -1272,6 +1364,8 @@
  *
  * This retrieves all statistics the underlying RTP engine supports and puts the values into the
  * stats structure.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat);
 
@@ -1289,6 +1383,8 @@
  *
  * This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to
  * by chan.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance);
 
@@ -1311,6 +1407,8 @@
  * \endcode
  *
  * This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
+ *
+ * \since 1.6.3
  */
 char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size);
 
@@ -1330,6 +1428,8 @@
  * \endcode
  *
  * This requests that the RTP engine provide audio frames in the ULAW format.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int format);
 
@@ -1349,6 +1449,8 @@
  * \endcode
  *
  * This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, int format);
 
@@ -1369,6 +1471,8 @@
  * \endcode
  *
  * This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer);
 
@@ -1387,6 +1491,8 @@
  * \endcode
  *
  * This tells the underlying RTP engine of instance that packets will now flow.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_activate(struct ast_rtp_instance *instance);
 
@@ -1405,6 +1511,8 @@
  *
  * This requests that the RTP engine send a STUN BIND request on the session pointed to by
  * 'instance'.
+ *
+ * \since 1.6.3
  */
 void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct sockaddr_in *suggestion, const char *username);
 
@@ -1422,6 +1530,7 @@
  *
  * This sets the RTP timeout value on 'instance' to be 5000.
  *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout);
 
@@ -1439,6 +1548,7 @@
  *
  * This sets the RTP hold timeout value on 'instance' to be 5000.
  *
+ * \since 1.6.3
  */
 void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout);
 
@@ -1456,6 +1566,8 @@
  * \endcode
  *
  * This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance);
 
@@ -1473,6 +1585,8 @@
  * \endcode
  *
  * This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
+ *
+ * \since 1.6.3
  */
 int ast_rtp_instance_get_hold_timeout(struct ast_rtp_instance *instance);
 

Modified: team/file/rtp_engine-mark2/main/rtp_engine.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/rtp_engine-mark2/main/rtp_engine.c?view=diff&rev=185776&r1=185775&r2=185776
==============================================================================
--- team/file/rtp_engine-mark2/main/rtp_engine.c (original)
+++ team/file/rtp_engine-mark2/main/rtp_engine.c Wed Apr  1 08:58:13 2009
@@ -62,13 +62,13 @@
 	enum ast_rtp_dtmf_mode dtmf_mode;
 };
 
-/* List of RTP engines that are currently registered */
+/*! List of RTP engines that are currently registered */
 static AST_RWLIST_HEAD_STATIC(engines, ast_rtp_engine);
 
-/* List of RTP glues */
+/*! List of RTP glues */
 static AST_RWLIST_HEAD_STATIC(glues, ast_rtp_glue);
 
-/* The following array defines the MIME Media type (and subtype) for each
+/*! The following array defines the MIME Media type (and subtype) for each
    of our codecs, or RTP-specific data type. */
 static const struct ast_rtp_mime_type {
 	struct ast_rtp_payload_type payload_type;
@@ -319,8 +319,7 @@
 	/* And pass it off to the engine to setup */
 	if (instance->engine->new(instance, sched, sin, data)) {
 		ast_debug(1, "Engine '%s' failed to setup RTP instance '%p'\n", engine->name, instance);
-		ast_module_unref(engine->mod);
-		ast_free(instance);
+		ao2_ref(instance, -1);
 		return NULL;
 	}
 
@@ -579,20 +578,20 @@
 	return result;
 }
 
-void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *AstFormats, int *nonAstFormats)
+void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astformats, int *nonastformats)
 {
 	int i;
 
-	*AstFormats = *nonAstFormats = 0;
+	*astformats = *nonastformats = 0;
 
 	for (i = 0; i < AST_RTP_MAX_PT; i++) {
 		if (codecs->payloads[i].code) {
 			ast_debug(1, "Incorporating payload %d on %p\n", i, codecs);
 		}
 		if (codecs->payloads[i].asterisk_format) {
-			*AstFormats |= codecs->payloads[i].code;
+			*astformats |= codecs->payloads[i].code;
 		} else {
-			*nonAstFormats |= codecs->payloads[i].code;
+			*nonastformats |= codecs->payloads[i].code;
 		}
 	}
 }
@@ -647,51 +646,32 @@
 	return 0;
 }
 
-char *ast_rtp_lookup_mime_multiple2(char *buf, size_t size, const int capability, const int asterisk_format, enum ast_rtp_options options)
-{
-	int format;
-	unsigned len;
-	char *end = buf, *start = buf;
-
-	if (!buf || !size) {
+char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const int capability, const int asterisk_format, enum ast_rtp_options options)
+{
+	int format, found = 0;
+
+	if (!buf) {
 		return NULL;
 	}
 
-	snprintf(end, size, "0x%x (", capability);
-
-	len = strlen(end);
-	end += len;
-	size -= len;
-	start = end;
+	ast_str_append(&buf, 0, "0x%x (", capability);
 
 	for (format = 1; format < AST_RTP_MAX; format <<= 1) {
 		if (capability & format) {
 			const char *name = ast_rtp_lookup_mime_subtype2(asterisk_format, format, options);
-
-			snprintf(end, size, "%s|", name);
-			len = strlen(end);
-			end += len;
-			size -= len;
-		}
-	}
-
-	if (start == end) {
-		ast_copy_string(start, "nothing)", size);
-	} else if (size > 1) {
-		*(end -1) = ')';
-	}
-
-	return buf;
+			ast_str_append(&buf, 0, "%s|", name);
+			found = 1;
+		}
+	}
+
+	ast_str_append(&buf, 0, "%s", found ? ")" : "nothing)");
+
+	return ast_str_buffer(buf);
 }
 
 void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs)
 {
-	int i;
-
-	for (i = 0; i < 32; i++) {
-		codecs->pref.order[i] = prefs->order[i];
-		codecs->pref.framing[i] = prefs->framing[i];
-	}
+	codecs->pref = *prefs;
 
 	if (instance && instance->engine->packetization_set) {
 		instance->engine->packetization_set(instance, &instance->codecs.pref);




More information about the asterisk-commits mailing list