[asterisk-commits] mmichelson: branch mmichelson/pool_shark r380448 - /team/mmichelson/pool_shar...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 29 18:42:32 CST 2013


Author: mmichelson
Date: Tue Jan 29 18:42:29 2013
New Revision: 380448

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380448
Log:
Make on_media_update run in threadpool.


Modified:
    team/mmichelson/pool_shark/res/res_sip_session.c

Modified: team/mmichelson/pool_shark/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/pool_shark/res/res_sip_session.c?view=diff&rev=380448&r1=380447&r2=380448
==============================================================================
--- team/mmichelson/pool_shark/res/res_sip_session.c (original)
+++ team/mmichelson/pool_shark/res/res_sip_session.c Tue Jan 29 18:42:29 2013
@@ -1203,8 +1203,27 @@
 }
 #endif
 
-static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)
-{
+struct media_update_data {
+	pjsip_inv_session *inv;
+	pj_status_t status;
+};
+
+static struct media_update_data *media_update_data_alloc(pjsip_inv_session *inv, pj_status_t status)
+{
+	struct media_update_data *mud = ao2_alloc(sizeof(*mud), NULL);
+	if (!mud) {
+		return NULL;
+	}
+	/* XXX Maybe bump the dialog refcount? */
+	mud->inv = inv;
+	mud->status = status;
+	return mud;
+}
+
+static int on_media_update(void *data)
+{
+	struct media_update_data *mud = data;
+	struct pjsip_inv_session *inv = mud->inv;
 	struct ast_sip_session *session = inv->mod_data[session_module.id];
 	const pjmedia_sdp_session *remote;
 
@@ -1212,6 +1231,17 @@
 	if (pjmedia_sdp_neg_get_active_remote(inv->neg, &remote) == PJ_SUCCESS) {
 		handle_incoming_sdp(session, remote);
 	}
+	return 0;
+}
+
+static void session_inv_on_media_update(pjsip_inv_session *inv, pj_status_t status)
+{
+	struct ast_sip_session *session = inv->mod_data[session_module.id];
+	struct media_update_data *mud = media_update_data_alloc(inv, status);
+	if (!mud) {
+		return;
+	}
+	ast_sip_push_task(session->work, on_media_update, mud);
 }
 
 static pjsip_redirect_op session_inv_on_redirected(pjsip_inv_session *inv, const pjsip_uri *target, const pjsip_event *e)




More information about the asterisk-commits mailing list