From 9d75f83c5d80be09012f51c2155fc4245d07b7dc Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sun, 3 Jun 2007 00:37:30 +0000 Subject: Add configuration with no thread (receive only) in siprtp git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1337 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/samples/siprtp.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'pjsip-apps') diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c index 573aa9c8..40ae172a 100644 --- a/pjsip-apps/src/samples/siprtp.c +++ b/pjsip-apps/src/samples/siprtp.c @@ -74,6 +74,16 @@ static const char *USAGE = #include +/* Uncomment these to disable threads. + * NOTE: + * when threading is disabled, siprtp won't transmit any + * RTP packets. + */ +/* +#undef PJ_HAS_THREADS +#define PJ_HAS_THREADS 0 +*/ + #if PJ_HAS_HIGH_RES_TIMER==0 # error "High resolution timer is needed for this sample" @@ -401,7 +411,13 @@ static pj_status_t init_media() /* Initialize media endpoint so that at least error subsystem is properly * initialized. */ +#if PJ_HAS_THREADS status = pjmedia_endpt_create(&app.cp.factory, NULL, 1, &app.med_endpt); +#else + status = pjmedia_endpt_create(&app.cp.factory, + pjsip_endpt_get_ioqueue(app.sip_endpt), + 0, &app.med_endpt); +#endif PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); @@ -1435,12 +1451,14 @@ static void call_on_media_update( pjsip_inv_session *inv, /* Start media thread. */ audio->thread_quit_flag = 0; +#if PJ_HAS_THREADS status = pj_thread_create( inv->pool, "media", &media_thread, audio, 0, 0, &audio->thread); if (status != PJ_SUCCESS) { app_perror(THIS_FILE, "Error creating media thread", status); return; } +#endif /* Set the media as active */ audio->active = PJ_TRUE; @@ -2070,10 +2088,12 @@ int main(int argc, char *argv[]) } /* Start worker threads */ +#if PJ_HAS_THREADS for (i=0; i