diff options
-rw-r--r-- | pjlib/src/pj/ioqueue_symbian.cpp | 2 | ||||
-rw-r--r-- | pjlib/src/pj/os_core_symbian.cpp | 19 | ||||
-rw-r--r-- | pjlib/src/pj/os_symbian.h | 2 | ||||
-rw-r--r-- | pjlib/src/pj/sock_symbian.cpp | 3 | ||||
-rw-r--r-- | pjlib/src/pj/timer_symbian.cpp | 3 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/sound_port.c | 26 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/symbian_sound.cpp | 4 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/transport_adapter_sample.c | 5 | ||||
-rw-r--r-- | pjmedia/src/pjmedia/wav_player.c | 2 | ||||
-rw-r--r-- | pjsip-apps/src/symbian_ua/main_symbian.cpp | 78 | ||||
-rw-r--r-- | pjsip-apps/src/symbian_ua/ua.cpp | 95 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_core.c | 18 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 2 |
13 files changed, 105 insertions, 154 deletions
diff --git a/pjlib/src/pj/ioqueue_symbian.cpp b/pjlib/src/pj/ioqueue_symbian.cpp index 1fa25085..4d534171 100644 --- a/pjlib/src/pj/ioqueue_symbian.cpp +++ b/pjlib/src/pj/ioqueue_symbian.cpp @@ -525,7 +525,7 @@ PJ_DEF(pj_status_t) pj_ioqueue_unregister( pj_ioqueue_key_t *key ) return PJ_SUCCESS; // Cancel pending async object - if (key->cbObj && key->cbObj->IsActive()) { + if (key->cbObj) { key->cbObj->Cancel(); } diff --git a/pjlib/src/pj/os_core_symbian.cpp b/pjlib/src/pj/os_core_symbian.cpp index 7718e6e8..3035bd72 100644 --- a/pjlib/src/pj/os_core_symbian.cpp +++ b/pjlib/src/pj/os_core_symbian.cpp @@ -89,8 +89,7 @@ CPjTimeoutTimer::CPjTimeoutTimer() CPjTimeoutTimer::~CPjTimeoutTimer() { - if (IsActive()) - Cancel(); + Cancel(); timer_.Close(); } @@ -115,8 +114,7 @@ CPjTimeoutTimer *CPjTimeoutTimer::NewL() void CPjTimeoutTimer::StartTimer(TUint miliSeconds) { - if (IsActive()) - Cancel(); + Cancel(); hasTimedOut_ = PJ_FALSE; timer_.After(iStatus, miliSeconds * 1000); @@ -329,7 +327,7 @@ PJ_DEF(pj_status_t) pj_init(void) TInt err; err = os->Initialize(); if (err != KErrNone) - return status; + return PJ_RETURN_OS_ERROR(err); /* Initialize exception ID for the pool. * Must do so after critical section is configured. @@ -452,7 +450,7 @@ PJ_DEF(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout) CPollTimeoutTimer *timer = NULL; if (priority==-1) - priority = CActive::EPriorityStandard; + priority = EPriorityNull; if (ms_timeout >= 0) { timer = CPollTimeoutTimer::NewL(ms_timeout, priority); @@ -463,8 +461,7 @@ PJ_DEF(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout) if (timer) { bool timer_is_active = timer->IsActive(); - if (timer_is_active) - timer->Cancel(); + timer->Cancel(); delete timer; @@ -622,11 +619,7 @@ PJ_DEF(pj_status_t) pj_thread_destroy(pj_thread_t *rec) PJ_DEF(pj_status_t) pj_thread_sleep(unsigned msec) { User::After(msec*1000); - - TInt aError; - while (CActiveScheduler::RunIfReady(aError, EPriorityMuchLess)) - ; - + return PJ_SUCCESS; } diff --git a/pjlib/src/pj/os_symbian.h b/pjlib/src/pj/os_symbian.h index be7fdb55..9fa3aae4 100644 --- a/pjlib/src/pj/os_symbian.h +++ b/pjlib/src/pj/os_symbian.h @@ -347,7 +347,7 @@ public: void WaitForActiveObjects(TInt aPriority = CActive::EPriorityStandard) { TInt aError; - User::WaitForAnyRequest(); + CActiveScheduler::Current()->WaitForAnyRequest(); CActiveScheduler::RunIfReady(aError, aPriority); } diff --git a/pjlib/src/pj/sock_symbian.cpp b/pjlib/src/pj/sock_symbian.cpp index 89c37236..18d0697f 100644 --- a/pjlib/src/pj/sock_symbian.cpp +++ b/pjlib/src/pj/sock_symbian.cpp @@ -101,8 +101,7 @@ CPjSocketReader *CPjSocket::CreateReader(unsigned max_len) void CPjSocket::DestroyReader() { if (sockReader_) { - if (sockReader_->IsActive()) - sockReader_->Cancel(); + sockReader_->Cancel(); delete sockReader_; sockReader_ = NULL; } diff --git a/pjlib/src/pj/timer_symbian.cpp b/pjlib/src/pj/timer_symbian.cpp index 20fc85b3..b61e667d 100644 --- a/pjlib/src/pj/timer_symbian.cpp +++ b/pjlib/src/pj/timer_symbian.cpp @@ -78,8 +78,7 @@ CPjTimerEntry::CPjTimerEntry(pj_timer_heap_t *timer_heap, CPjTimerEntry::~CPjTimerEntry() { - if (IsActive()) - Cancel(); + Cancel(); rtimer_.Close(); } diff --git a/pjmedia/src/pjmedia/sound_port.c b/pjmedia/src/pjmedia/sound_port.c index 50f35d8e..766fb14b 100644 --- a/pjmedia/src/pjmedia/sound_port.c +++ b/pjmedia/src/pjmedia/sound_port.c @@ -371,8 +371,6 @@ PJ_DEF(pj_status_t) pjmedia_snd_port_create( pj_pool_t *pool, pjmedia_snd_port **p_port) { pjmedia_snd_port *snd_port; - pj_status_t status; - unsigned ptime; PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); @@ -389,17 +387,19 @@ PJ_DEF(pj_status_t) pjmedia_snd_port_create( pj_pool_t *pool, snd_port->bits_per_sample = bits_per_sample; #if PJMEDIA_SOUND_USE_DELAYBUF - ptime = samples_per_frame * 1000 / (clock_rate * channel_count); - - status = pjmedia_delay_buf_create(pool, "snd_buff", - clock_rate, samples_per_frame, - channel_count, - PJMEDIA_SOUND_BUFFER_COUNT * ptime, - 0, &snd_port->delay_buf); - PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); -#else - PJ_UNUSED_ARG(status); - PJ_UNUSED_ARG(ptime); + do { + pj_status_t status; + unsigned ptime; + + ptime = samples_per_frame * 1000 / (clock_rate * channel_count); + + status = pjmedia_delay_buf_create(pool, "snd_buff", + clock_rate, samples_per_frame, + channel_count, + PJMEDIA_SOUND_BUFFER_COUNT * ptime, + 0, &snd_port->delay_buf); + PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); + } while (0); #endif *p_port = snd_port; diff --git a/pjmedia/src/pjmedia/symbian_sound.cpp b/pjmedia/src/pjmedia/symbian_sound.cpp index 1759e99a..a57c8c4e 100644 --- a/pjmedia/src/pjmedia/symbian_sound.cpp +++ b/pjmedia/src/pjmedia/symbian_sound.cpp @@ -297,7 +297,7 @@ void CPjAudioInputEngine::Stop() // Wait until it's actually stopped while (lastError_ == KRequestPending) - pj_thread_sleep(100); + pj_symbianos_poll(-1, 100); } if (iInputStream_) { @@ -533,7 +533,7 @@ void CPjAudioOutputEngine::Stop() // Wait until it's actually stopped while (lastError_ == KRequestPending) - pj_thread_sleep(100); + pj_symbianos_poll(-1, 100); } if (iOutputStream_) { diff --git a/pjmedia/src/pjmedia/transport_adapter_sample.c b/pjmedia/src/pjmedia/transport_adapter_sample.c index b4d4c9da..414a86ad 100644 --- a/pjmedia/src/pjmedia/transport_adapter_sample.c +++ b/pjmedia/src/pjmedia/transport_adapter_sample.c @@ -1,4 +1,4 @@ -/* $Id:$ */ +/* $Id$ */ /* * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> * @@ -131,7 +131,8 @@ PJ_DEF(pj_status_t) pjmedia_tp_adapter_create( pjmedia_endpt *endpt, adapter->pool = pool; pj_ansi_strncpy(adapter->base.name, pool->obj_name, sizeof(adapter->base.name)); - adapter->base.type = PJMEDIA_TRANSPORT_TYPE_USER + 1; + adapter->base.type = (pjmedia_transport_type) + (PJMEDIA_TRANSPORT_TYPE_USER + 1); adapter->base.op = &tp_adapter_op; /* Save the transport as the slave transport */ diff --git a/pjmedia/src/pjmedia/wav_player.c b/pjmedia/src/pjmedia/wav_player.c index 30c2531e..fa94d071 100644 --- a/pjmedia/src/pjmedia/wav_player.c +++ b/pjmedia/src/pjmedia/wav_player.c @@ -263,7 +263,7 @@ PJ_DEF(pj_status_t) pjmedia_wav_player_port_create( pj_pool_t *pool, return status; } - fport->fmt_tag = wave_hdr.fmt_hdr.fmt_tag; + fport->fmt_tag = (pjmedia_wave_fmt_tag)wave_hdr.fmt_hdr.fmt_tag; fport->bytes_per_sample = (pj_uint16_t) (wave_hdr.fmt_hdr.bits_per_sample / 8); diff --git a/pjsip-apps/src/symbian_ua/main_symbian.cpp b/pjsip-apps/src/symbian_ua/main_symbian.cpp index 1786148f..c3d0fda3 100644 --- a/pjsip-apps/src/symbian_ua/main_symbian.cpp +++ b/pjsip-apps/src/symbian_ua/main_symbian.cpp @@ -28,73 +28,10 @@ CConsoleBase* console; // Needed by APS -TPtrC APP_UID = _L("A000000E"); +TPtrC APP_UID = _L("A000000D"); //////////////////////////////////////////////////////////////////////////// -class MyTask : public CActive -{ -public: - static MyTask *NewL(CActiveSchedulerWait *asw); - ~MyTask(); - void Start(); - -protected: - MyTask(CActiveSchedulerWait *asw); - void ConstructL(); - virtual void RunL(); - virtual void DoCancel(); - -private: - RTimer timer_; - CActiveSchedulerWait *asw_; -}; - -MyTask::MyTask(CActiveSchedulerWait *asw) -: CActive(EPriorityNormal), asw_(asw) -{ -} - -MyTask::~MyTask() -{ - timer_.Close(); -} - -void MyTask::ConstructL() -{ - timer_.CreateLocal(); - CActiveScheduler::Add(this); -} - -MyTask *MyTask::NewL(CActiveSchedulerWait *asw) -{ - MyTask *self = new (ELeave) MyTask(asw); - CleanupStack::PushL(self); - - self->ConstructL(); - - CleanupStack::Pop(self); - return self; -} - -void MyTask::Start() -{ - timer_.After(iStatus, 0); - SetActive(); -} - -void MyTask::RunL() -{ - ua_main(); - asw_->AsyncStop(); -} - -void MyTask::DoCancel() -{ - -} - -//////////////////////////////////////////////////////////////////////////// LOCAL_C void DoStartL() { @@ -102,18 +39,7 @@ LOCAL_C void DoStartL() CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); - CActiveSchedulerWait *asw = new CActiveSchedulerWait; - CleanupStack::PushL(asw); - - MyTask *task = MyTask::NewL(asw); - task->Start(); - - asw->Start(); - - delete task; - - CleanupStack::Pop(asw); - delete asw; + ua_main(); CActiveScheduler::Install(NULL); CleanupStack::Pop(scheduler); diff --git a/pjsip-apps/src/symbian_ua/ua.cpp b/pjsip-apps/src/symbian_ua/ua.cpp index 7e4c9c3a..15178d9b 100644 --- a/pjsip-apps/src/symbian_ua/ua.cpp +++ b/pjsip-apps/src/symbian_ua/ua.cpp @@ -37,7 +37,7 @@ // // Account // -#define HAS_SIP_ACCOUNT 1 // 0 to disable registration +#define HAS_SIP_ACCOUNT 0 // 1 to enable registration #define SIP_DOMAIN "pjsip.lab" #define SIP_USER "400" #define SIP_PASSWD "400" @@ -53,8 +53,8 @@ // Configure nameserver if DNS SRV is to be used with both SIP // or STUN (for STUN see other settings below) // -//#define NAMESERVER NULL -#define NAMESERVER "192.168.0.2" +#define NAMESERVER NULL +//#define NAMESERVER "192.168.0.2" // // STUN server @@ -249,6 +249,8 @@ static void on_call_replaced(pjsua_call_id old_call_id, } +//#include<e32debug.h> + /* Logging callback */ static void log_writer(int level, const char *buf, int len) { @@ -259,6 +261,7 @@ static void log_writer(int level, const char *buf, int len) pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16)); TPtrC16 aBuf((const TUint16*)buf16, (TInt)len); + //RDebug::Print(aBuf); console->Write(aBuf); } @@ -435,7 +438,7 @@ static pj_status_t app_startup() class ConsoleUI : public CActive { public: - ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con); + ConsoleUI(CConsoleBase *con); // Run console UI void Run(); @@ -451,13 +454,12 @@ protected: void RunL(); private: - CActiveSchedulerWait *asw_; CConsoleBase *con_; }; -ConsoleUI::ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con) -: CActive(EPriorityStandard), asw_(asw), con_(con) +ConsoleUI::ConsoleUI(CConsoleBase *con) +: CActive(EPriorityStandard), con_(con) { CActiveScheduler::Add(this); } @@ -508,7 +510,7 @@ void ConsoleUI::RunL() switch (kc) { case 'w': - asw_->AsyncStop(); + CActiveScheduler::Stop(); reschedule = PJ_FALSE; break; case 'D': @@ -685,14 +687,57 @@ on_return: #include <es_sock.h> +#if 0 +// Force network connection to use the first IAP, +// this is useful for debugging on emulator without GUI. +// Include commdb.lib & apengine.lib in symbian_ua.mmp file +// if this is enabled. + +#include <apdatahandler.h> + +inline void ForceUseFirstIAP() +{ + TUint32 rank = 1; + TUint32 bearers; + TUint32 prompt; + TUint32 iap; + + CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); + CleanupStack::PushL(commDb); + + CApDataHandler* apDataHandler = CApDataHandler::NewLC(*commDb); + + TCommDbConnectionDirection direction = ECommDbConnectionDirectionOutgoing; + apDataHandler->GetPreferredIfDbIapTypeL(rank, direction, bearers, prompt, iap); + prompt = ECommDbDialogPrefDoNotPrompt; + apDataHandler->SetPreferredIfDbIapTypeL(rank, direction, bearers, (TCommDbDialogPref)prompt, iap, ETrue); + CleanupStack::PopAndDestroy(2); // apDataHandler, commDb +} + +static void SelectIAP() +{ + ForceUseFirstIAP(); +} + +#else + +static void SelectIAP() +{ +} + +#endif + + //////////////////////////////////////////////////////////////////////////// int ua_main() { - RSocketServ aSocketServer; - RConnection aConn; - TInt err; - pj_symbianos_params sym_params; + RSocketServ aSocketServer; + RConnection aConn; + TInt err; + pj_symbianos_params sym_params; pj_status_t status; + + SelectIAP(); // Initialize RSocketServ if ((err=aSocketServer.Connect()) != KErrNone) @@ -700,8 +745,8 @@ int ua_main() // Open up a connection if ((err=aConn.Open(aSocketServer)) != KErrNone) { - aSocketServer.Close(); - return PJ_STATUS_FROM_OS(err); + aSocketServer.Close(); + return PJ_STATUS_FROM_OS(err); } if ((err=aConn.Start()) != KErrNone) { @@ -722,39 +767,37 @@ int ua_main() if (status != PJ_SUCCESS) { aConn.Close(); aSocketServer.Close(); - return status; + return status; } // Run the UI - CActiveSchedulerWait *asw = new CActiveSchedulerWait; - ConsoleUI *con = new ConsoleUI(asw, console); + ConsoleUI *con = new ConsoleUI(console); con->Run(); - PrintMenu(); - asw->Start(); + + CActiveScheduler::Start(); delete con; - delete asw; // Dump memory statistics PJ_LOG(3,(THIS_FILE, "Max heap usage: %u.%03uMB", - pjsua_var.cp.peak_used_size / 1000000, - (pjsua_var.cp.peak_used_size % 1000000)/1000)); + pjsua_var.cp.peak_used_size / 1000000, + (pjsua_var.cp.peak_used_size % 1000000)/1000)); // check max stack usage #if defined(PJ_OS_HAS_CHECK_STACK) && PJ_OS_HAS_CHECK_STACK!=0 pj_thread_t* this_thread = pj_thread_this(); if (!this_thread) - return status; + return status; const char* max_stack_file; int max_stack_line; status = pj_thread_get_stack_info(this_thread, &max_stack_file, &max_stack_line); PJ_LOG(3,(THIS_FILE, "Max stack usage: %u at %s:%d", - pj_thread_get_stack_max_usage(this_thread), - max_stack_file, max_stack_line)); + pj_thread_get_stack_max_usage(this_thread), + max_stack_file, max_stack_line)); #endif // Shutdown pjsua @@ -762,7 +805,7 @@ int ua_main() // Close connection and socket server aConn.Close(); - aSocketServer.Close(); + aSocketServer.Close(); return status; } diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c index 650217a2..18bf542a 100644 --- a/pjsip/src/pjsua-lib/pjsua_core.c +++ b/pjsip/src/pjsua-lib/pjsua_core.c @@ -827,13 +827,6 @@ on_error: /* Sleep with polling */ static void busy_sleep(unsigned msec) { -#if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 - /* Ideally we shouldn't call pj_thread_sleep() and rather - * CActiveScheduler::WaitForAnyRequest() here, but that will - * drag in Symbian header and it doesn't look pretty. - */ - pj_thread_sleep(msec); -#else pj_time_val timeout, now; pj_gettimeofday(&timeout); @@ -845,7 +838,6 @@ static void busy_sleep(unsigned msec) ; pj_gettimeofday(&now); } while (PJ_TIME_VAL_LT(now, timeout)); -#endif } @@ -1203,12 +1195,9 @@ PJ_DEF(pj_status_t) pjsua_start(void) PJ_DEF(int) pjsua_handle_events(unsigned msec_timeout) { #if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 - /* Ideally we shouldn't call pj_thread_sleep() and rather - * CActiveScheduler::WaitForAnyRequest() here, but that will - * drag in Symbian header and it doesn't look pretty. - */ - pj_thread_sleep(msec_timeout); - return msec_timeout; + + return pj_symbianos_poll(-1, msec_timeout); + #else unsigned count = 0; @@ -1225,6 +1214,7 @@ PJ_DEF(int) pjsua_handle_events(unsigned msec_timeout) return -status; return count; + #endif } diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index 0e3cc211..41af06a9 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -776,7 +776,7 @@ static pj_bool_t pres_on_rx_request(pjsip_rx_data *rdata) else uapres->expires = -1; - st_code = 200; + st_code = (pjsip_status_code)200; reason = pj_str("OK"); pjsua_msg_data_init(&msg_data); |