From bbfe61da5f6825d0b1451ff2c88d2e538514f3a7 Mon Sep 17 00:00:00 2001 From: Stefan Sayer Date: Fri, 6 Oct 2006 15:13:33 +0000 Subject: [PATCH] changed SessionScheduler name to MediaProcessor ivr python version changed to 2.4 by default Makefile git-svn-id: http://svn.berlios.de/svnroot/repos/sems/trunk@95 8eb893ce-cfd4-0310-b710-fb5ebe64c474 --- apps/ann_b2b/AnnounceB2B.cpp | 1 - apps/announcement/Announcement.cpp | 1 - apps/conference/Conference.cpp | 4 ++-- apps/early_announce/EarlyAnnounce.cpp | 1 - apps/ivr/Ivr.cpp | 2 -- apps/ivr/Makefile | 4 ++-- apps/voicemail/AnswerMachine.cpp | 1 - core/AmConfig.cpp | 12 ++++++------ core/AmConfig.h | 6 +++--- core/AmDtmfDetector.h | 3 ++- .../{AmSessionScheduler.cpp => AmMediaProcessor.cpp} | 2 +- core/{AmSessionScheduler.h => AmMediaProcessor.h} | 0 core/AmSession.cpp | 12 ++++++------ core/AmSession.h | 4 ++-- core/sems.conf.sample | 8 ++++++++ core/sems.cpp | 7 +++---- core/sems.h | 2 +- 17 files changed, 36 insertions(+), 34 deletions(-) rename core/{AmSessionScheduler.cpp => AmMediaProcessor.cpp} (99%) rename core/{AmSessionScheduler.h => AmMediaProcessor.h} (100%) diff --git a/apps/ann_b2b/AnnounceB2B.cpp b/apps/ann_b2b/AnnounceB2B.cpp index 2234488c..f320f26a 100644 --- a/apps/ann_b2b/AnnounceB2B.cpp +++ b/apps/ann_b2b/AnnounceB2B.cpp @@ -26,7 +26,6 @@ */ #include "AnnounceB2B.h" -#include "AmSessionScheduler.h" #include "AmSessionContainer.h" #include "AmConfig.h" #include "AmUtils.h" diff --git a/apps/announcement/Announcement.cpp b/apps/announcement/Announcement.cpp index 10f44b53..676e585a 100644 --- a/apps/announcement/Announcement.cpp +++ b/apps/announcement/Announcement.cpp @@ -28,7 +28,6 @@ #include "Announcement.h" #include "AmConfig.h" #include "AmUtils.h" -#include "AmSessionScheduler.h" #include "sems.h" #include "log.h" diff --git a/apps/conference/Conference.cpp b/apps/conference/Conference.cpp index f4e7d74f..cda8b842 100644 --- a/apps/conference/Conference.cpp +++ b/apps/conference/Conference.cpp @@ -32,7 +32,7 @@ #include "AmConfig.h" #include "AmSessionContainer.h" -#include "AmSessionScheduler.h" +#include "AmMediaProcessor.h" #include "sems.h" #include "log.h" @@ -443,7 +443,7 @@ void ConferenceDialog::onSipReply(const AmSipReply& reply) onSessionStart(reply); if(getInput() || getOutput()) - AmSessionScheduler::instance()->addSession(this, + AmMediaProcessor::instance()->addSession(this, getCallgroup()); else { ERROR("missing audio input and/or ouput.\n"); diff --git a/apps/early_announce/EarlyAnnounce.cpp b/apps/early_announce/EarlyAnnounce.cpp index 1b9e62e0..9faa0dac 100644 --- a/apps/early_announce/EarlyAnnounce.cpp +++ b/apps/early_announce/EarlyAnnounce.cpp @@ -28,7 +28,6 @@ #include "EarlyAnnounce.h" #include "AmConfig.h" #include "AmUtils.h" -#include "AmSessionScheduler.h" #include "sems.h" #include "log.h" diff --git a/apps/ivr/Ivr.cpp b/apps/ivr/Ivr.cpp index 9d6508a5..9eb0db29 100644 --- a/apps/ivr/Ivr.cpp +++ b/apps/ivr/Ivr.cpp @@ -30,8 +30,6 @@ #include "log.h" #include "AmApi.h" #include "AmUtils.h" -#include "AmSessionScheduler.h" -//#include "AmSessionTimer.h" #include "AmPlugIn.h" #include diff --git a/apps/ivr/Makefile b/apps/ivr/Makefile index 5a819efe..5249a85e 100644 --- a/apps/ivr/Makefile +++ b/apps/ivr/Makefile @@ -11,14 +11,14 @@ TTS = y # # PYTHON_VERSION might also be 2.2 -- except for the use of GIL # do a ls /usr/include/python2.3/Python.h to see if it's there -PY_VER = 2.3 +PY_VER = 2.4 # adjust to point to python include path # can also be /usr/include/python$(PY_VER) # look for Python.h in the specified path # Python prefix is what you configured python with # if you built from source (e.g. ./configure --with-prefix=/usr/local) # on debian it's often /usr, on SuSE and FreeBSD /usr/local -PYTHON_PREFIX = /usr +PYTHON_PREFIX = /usr/local PYTHON_DIR = $(PYTHON_PREFIX)/include/python$(PY_VER) PYTHON_LIBDIR = $(PYTHON_PREFIX)/lib/python$(PY_VER) diff --git a/apps/voicemail/AnswerMachine.cpp b/apps/voicemail/AnswerMachine.cpp index 45ee9de6..d5959afb 100644 --- a/apps/voicemail/AnswerMachine.cpp +++ b/apps/voicemail/AnswerMachine.cpp @@ -33,7 +33,6 @@ #include "AmUtils.h" #include "AmPlugIn.h" #include "AmPlaylist.h" -#include "AmSessionScheduler.h" #include "sems.h" #include "log.h" diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp index 1a5a4bdf..40867a4b 100644 --- a/core/AmConfig.cpp +++ b/core/AmConfig.cpp @@ -50,7 +50,7 @@ string AmConfig::LocalIP = ""; string AmConfig::PrefixSep = PREFIX_SEPARATOR; int AmConfig::RtpLowPort = RTP_LOWPORT; int AmConfig::RtpHighPort = RTP_HIGHPORT; -int AmConfig::SessionSchedulerThreads = NUM_SESSION_SCHEDULERS; +int AmConfig::MediaProcessorThreads = NUM_MEDIA_PROCESSORS; AmSessionTimerConfig AmConfig::defaultSessionTimerConfig; @@ -109,8 +109,8 @@ int AmConfig::setStderr(const string& s) { return 1; } -int AmConfig::setSessionSchedulerThreads(const string& th) { - if(sscanf(th.c_str(),"%u",&SessionSchedulerThreads) != 1) { +int AmConfig::setMediaProcessorThreads(const string& th) { + if(sscanf(th.c_str(),"%u",&MediaProcessorThreads) != 1) { return 0; } return 1; @@ -204,9 +204,9 @@ DBG("RvR :- Local IP set to %s\n", LocalIP.c_str()); } } - if(cfg.hasParameter("session_scheduler_threads")){ - if(!setSessionSchedulerThreads(cfg.getParameter("session_scheduler_threads"))){ - ERROR("invalid session_scheduler_threads value specified"); + if(cfg.hasParameter("media_processor_threads")){ + if(!setMediaProcessorThreads(cfg.getParameter("media_processor_threads"))){ + ERROR("invalid media_processor_threads value specified"); return -1; } } diff --git a/core/AmConfig.h b/core/AmConfig.h index 23df253f..838fe78d 100644 --- a/core/AmConfig.h +++ b/core/AmConfig.h @@ -76,7 +76,7 @@ struct AmConfig /* Session Timer: -ssa */ static AmSessionTimerConfig defaultSessionTimerConfig; /** number of session scheduler threads */ - static int SessionSchedulerThreads; + static int MediaProcessorThreads; /** Init function. Resolves SMTP server address. */ static int init(); @@ -98,8 +98,8 @@ struct AmConfig static int setFork(const string& fork); /** Setter for parameter stderr, returns 0 on invalid value */ static int setStderr(const string& s); - /** Setter for parameter SessionSchedulerThreads, returns 0 on invalid value */ - static int setSessionSchedulerThreads(const string& th); + /** Setter for parameter MediaProcessorThreads, returns 0 on invalid value */ + static int setMediaProcessorThreads(const string& th); }; class AmConfigReader; diff --git a/core/AmDtmfDetector.h b/core/AmDtmfDetector.h index bba05efd..fd2c2e45 100644 --- a/core/AmDtmfDetector.h +++ b/core/AmDtmfDetector.h @@ -294,7 +294,8 @@ private: AmMutex m_reportLock; /** - * Implementation of AmEventHandler::process(). Processes events from AmSessionScheduler. + * Implementation of AmEventHandler::process(). + * Processes events from AmMediaProcessor. * @see AmEventHandler */ virtual void process(AmEvent *); diff --git a/core/AmSessionScheduler.cpp b/core/AmMediaProcessor.cpp similarity index 99% rename from core/AmSessionScheduler.cpp rename to core/AmMediaProcessor.cpp index 5ed6694c..6ee651ec 100644 --- a/core/AmSessionScheduler.cpp +++ b/core/AmMediaProcessor.cpp @@ -25,7 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "AmSessionScheduler.h" +#include "AmMediaProcessor.h" #include #include diff --git a/core/AmSessionScheduler.h b/core/AmMediaProcessor.h similarity index 100% rename from core/AmSessionScheduler.h rename to core/AmMediaProcessor.h diff --git a/core/AmSession.cpp b/core/AmSession.cpp index 43ab3f24..992ec7c3 100644 --- a/core/AmSession.cpp +++ b/core/AmSession.cpp @@ -35,7 +35,7 @@ #include "AmPlugIn.h" #include "AmApi.h" #include "AmSessionContainer.h" -#include "AmSessionScheduler.h" +#include "AmMediaProcessor.h" #include "AmDtmfDetector.h" #include "log.h" @@ -324,7 +324,7 @@ void AmSession::run() destroy(); // wait at least until session is out of RtpScheduler - DBG("session is stopped, waiting for detach from SessionScheduler.\n"); + DBG("session is stopped, waiting for detach from MediaProcessor.\n"); //detached.wait_for(); } @@ -332,7 +332,7 @@ void AmSession::on_stop() { //sess_stopped.set(true); DBG("AmSession::on_stop()\n"); - AmSessionScheduler::instance()->removeSession(this); + AmMediaProcessor::instance()->removeSession(this); } void AmSession::destroy() @@ -479,7 +479,7 @@ void AmSession::onSipRequest(const AmSipRequest& req) onSessionStart(req); if(input || output) - AmSessionScheduler::instance()->addSession(this, callgroup); + AmMediaProcessor::instance()->addSession(this, callgroup); else { ERROR("missing audio input and/or ouput.\n"); } @@ -533,8 +533,8 @@ void AmSession::onSipReply(const AmSipReply& reply) onSessionStart(reply); if(input || output) - AmSessionScheduler::instance()->addSession(this, - callgroup); + AmMediaProcessor::instance()->addSession(this, + callgroup); else { ERROR("missing audio input and/or ouput.\n"); } diff --git a/core/AmSession.h b/core/AmSession.h index 69dd1ed1..bbb74819 100644 --- a/core/AmSession.h +++ b/core/AmSession.h @@ -123,8 +123,8 @@ class AmSession : public AmThread, AmCondition sess_stopped; AmCondition detached; - friend class AmSessionScheduler; - friend class AmSessionSchedulerThread; + friend class AmMediaProcessor; + friend class AmMediaProcessorThread; friend class AmSessionContainer; friend class AmSessionFactory; diff --git a/core/sems.conf.sample b/core/sems.conf.sample index 79c0baf8..7e4b0992 100644 --- a/core/sems.conf.sample +++ b/core/sems.conf.sample @@ -70,3 +70,11 @@ rtp_low_port=10000 # # - sets port of rtp highest server rtp_high_port=60000 + +# optional parameter: media_processor_threads= +# +# - controls how many threads should be created that +# process media - on single-processor systems set this +# parameter to 1 (default), on MP systems to a higher +# value +media_processor_threads=1 \ No newline at end of file diff --git a/core/sems.cpp b/core/sems.cpp index e3193856..396a1d74 100644 --- a/core/sems.cpp +++ b/core/sems.cpp @@ -35,7 +35,7 @@ #include "AmServer.h" #include "AmCtrlInterface.h" #include "AmInterfaceHandler.h" -#include "AmSessionScheduler.h" +#include "AmMediaProcessor.h" #include "AmIcmpWatcher.h" #include "AmRtpReceiver.h" //#include "AmSessionTimer.h" @@ -402,9 +402,8 @@ int main(int argc, char* argv[]) DBG("Starting session container\n"); AmSessionContainer::instance()->start(); - DBG("Starting session scheduler\n"); - AmSessionScheduler::instance()->init(); - // AmSessionScheduler::instance()->start(true); + DBG("Starting media processor\n"); + AmMediaProcessor::instance()->init(); DBG("Starting mailer\n"); AmMailDeamon::instance()->start(); diff --git a/core/sems.h b/core/sems.h index 210959a3..35cba835 100644 --- a/core/sems.h +++ b/core/sems.h @@ -50,7 +50,7 @@ #define SESSION_EXPIRES 10 // seconds #define MINIMUM_TIMER 5 //seconds -#define NUM_SESSION_SCHEDULERS 1 +#define NUM_MEDIA_PROCESSORS 1 #define MAX_NET_DEVICES 32