Changeset 2379 for pjproject/trunk


Ignore:
Timestamp:
Dec 17, 2008 11:36:22 AM (15 years ago)
Author:
nanang
Message:

Ticket #675:

  • Fixed ICE+STUN panic E32User-CBASE 46, the problem seems to be inside the Symbian version of pjsua_handle_events().
  • Updated minor things, e.g: compile warnings
Location:
pjproject/trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ioqueue_symbian.cpp

    r2039 r2379  
    526526 
    527527    // Cancel pending async object 
    528     if (key->cbObj && key->cbObj->IsActive()) { 
     528    if (key->cbObj) { 
    529529        key->cbObj->Cancel(); 
    530530    } 
  • pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp

    r2039 r2379  
    9090CPjTimeoutTimer::~CPjTimeoutTimer() 
    9191{ 
    92     if (IsActive()) 
    93         Cancel(); 
     92    Cancel(); 
    9493    timer_.Close(); 
    9594} 
     
    116115void CPjTimeoutTimer::StartTimer(TUint miliSeconds) 
    117116{ 
    118     if (IsActive()) 
    119         Cancel(); 
     117    Cancel(); 
    120118 
    121119    hasTimedOut_ = PJ_FALSE; 
     
    330328    err = os->Initialize(); 
    331329    if (err != KErrNone) 
    332         return status; 
     330        return PJ_RETURN_OS_ERROR(err); 
    333331     
    334332    /* Initialize exception ID for the pool.  
     
    453451     
    454452    if (priority==-1) 
    455         priority = CActive::EPriorityStandard; 
     453        priority = EPriorityNull; 
    456454     
    457455    if (ms_timeout >= 0) { 
     
    464462        bool timer_is_active = timer->IsActive(); 
    465463     
    466         if (timer_is_active) 
    467             timer->Cancel(); 
     464        timer->Cancel(); 
    468465         
    469466        delete timer; 
     
    623620{ 
    624621    User::After(msec*1000); 
    625      
    626     TInt aError; 
    627     while (CActiveScheduler::RunIfReady(aError, EPriorityMuchLess)) 
    628         ; 
    629      
     622 
    630623    return PJ_SUCCESS; 
    631624} 
  • pjproject/trunk/pjlib/src/pj/os_symbian.h

    r2039 r2379  
    348348    { 
    349349        TInt aError; 
    350         User::WaitForAnyRequest(); 
     350        CActiveScheduler::Current()->WaitForAnyRequest(); 
    351351        CActiveScheduler::RunIfReady(aError, aPriority); 
    352352    } 
  • pjproject/trunk/pjlib/src/pj/sock_symbian.cpp

    r2327 r2379  
    102102{ 
    103103    if (sockReader_) { 
    104         if (sockReader_->IsActive()) 
    105             sockReader_->Cancel(); 
     104        sockReader_->Cancel(); 
    106105        delete sockReader_; 
    107106        sockReader_ = NULL; 
  • pjproject/trunk/pjlib/src/pj/timer_symbian.cpp

    r2039 r2379  
    7979CPjTimerEntry::~CPjTimerEntry()  
    8080{ 
    81     if (IsActive()) 
    82         Cancel(); 
     81    Cancel(); 
    8382    rtimer_.Close(); 
    8483} 
  • pjproject/trunk/pjmedia/src/pjmedia/sound_port.c

    r2198 r2379  
    372372{ 
    373373    pjmedia_snd_port *snd_port; 
    374     pj_status_t status; 
    375     unsigned ptime; 
    376374 
    377375    PJ_ASSERT_RETURN(pool && p_port, PJ_EINVAL); 
     
    390388     
    391389#if PJMEDIA_SOUND_USE_DELAYBUF 
    392     ptime = samples_per_frame * 1000 / (clock_rate * channel_count); 
    393  
    394     status = pjmedia_delay_buf_create(pool, "snd_buff",  
    395                                       clock_rate, samples_per_frame, 
    396                                       channel_count, 
    397                                       PJMEDIA_SOUND_BUFFER_COUNT * ptime, 
    398                                       0, &snd_port->delay_buf); 
    399     PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    400 #else 
    401     PJ_UNUSED_ARG(status); 
    402     PJ_UNUSED_ARG(ptime); 
     390    do { 
     391        pj_status_t status; 
     392        unsigned ptime; 
     393     
     394        ptime = samples_per_frame * 1000 / (clock_rate * channel_count); 
     395     
     396        status = pjmedia_delay_buf_create(pool, "snd_buff",  
     397                                          clock_rate, samples_per_frame, 
     398                                          channel_count, 
     399                                          PJMEDIA_SOUND_BUFFER_COUNT * ptime, 
     400                                          0, &snd_port->delay_buf); 
     401        PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
     402    } while (0); 
    403403#endif 
    404404 
  • pjproject/trunk/pjmedia/src/pjmedia/symbian_sound.cpp

    r2357 r2379  
    298298        // Wait until it's actually stopped 
    299299        while (lastError_ == KRequestPending) 
    300             pj_thread_sleep(100); 
     300            pj_symbianos_poll(-1, 100); 
    301301    } 
    302302 
     
    534534        // Wait until it's actually stopped 
    535535        while (lastError_ == KRequestPending) 
    536             pj_thread_sleep(100); 
     536            pj_symbianos_poll(-1, 100); 
    537537    } 
    538538     
  • pjproject/trunk/pjmedia/src/pjmedia/transport_adapter_sample.c

    r2262 r2379  
    1 /* $Id:$ */ 
     1/* $Id$ */ 
    22/*  
    33 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org> 
     
    132132    pj_ansi_strncpy(adapter->base.name, pool->obj_name,  
    133133                    sizeof(adapter->base.name)); 
    134     adapter->base.type = PJMEDIA_TRANSPORT_TYPE_USER + 1; 
     134    adapter->base.type = (pjmedia_transport_type) 
     135                         (PJMEDIA_TRANSPORT_TYPE_USER + 1); 
    135136    adapter->base.op = &tp_adapter_op; 
    136137 
  • pjproject/trunk/pjmedia/src/pjmedia/wav_player.c

    r2272 r2379  
    264264    } 
    265265 
    266     fport->fmt_tag = wave_hdr.fmt_hdr.fmt_tag; 
     266    fport->fmt_tag = (pjmedia_wave_fmt_tag)wave_hdr.fmt_hdr.fmt_tag; 
    267267    fport->bytes_per_sample = (pj_uint16_t)  
    268268                              (wave_hdr.fmt_hdr.bits_per_sample / 8); 
  • pjproject/trunk/pjsip-apps/src/symbian_ua/main_symbian.cpp

    r2174 r2379  
    2929 
    3030// Needed by APS 
    31 TPtrC APP_UID = _L("A000000E"); 
     31TPtrC APP_UID = _L("A000000D"); 
    3232 
    33  
    34 //////////////////////////////////////////////////////////////////////////// 
    35 class MyTask : public CActive 
    36 { 
    37 public: 
    38     static MyTask *NewL(CActiveSchedulerWait *asw); 
    39     ~MyTask(); 
    40     void Start(); 
    41  
    42 protected: 
    43     MyTask(CActiveSchedulerWait *asw); 
    44     void ConstructL(); 
    45     virtual void RunL(); 
    46     virtual void DoCancel(); 
    47  
    48 private: 
    49     RTimer timer_; 
    50     CActiveSchedulerWait *asw_; 
    51 }; 
    52  
    53 MyTask::MyTask(CActiveSchedulerWait *asw) 
    54 : CActive(EPriorityNormal), asw_(asw) 
    55 { 
    56 } 
    57  
    58 MyTask::~MyTask()  
    59 { 
    60     timer_.Close(); 
    61 } 
    62  
    63 void MyTask::ConstructL() 
    64 { 
    65     timer_.CreateLocal(); 
    66     CActiveScheduler::Add(this); 
    67 } 
    68  
    69 MyTask *MyTask::NewL(CActiveSchedulerWait *asw) 
    70 { 
    71     MyTask *self = new (ELeave) MyTask(asw); 
    72     CleanupStack::PushL(self); 
    73  
    74     self->ConstructL(); 
    75  
    76     CleanupStack::Pop(self); 
    77     return self; 
    78 } 
    79  
    80 void MyTask::Start() 
    81 { 
    82     timer_.After(iStatus, 0); 
    83     SetActive(); 
    84 } 
    85  
    86 void MyTask::RunL() 
    87 { 
    88     ua_main(); 
    89     asw_->AsyncStop(); 
    90 } 
    91  
    92 void MyTask::DoCancel() 
    93 { 
    94  
    95 } 
    9633 
    9734//////////////////////////////////////////////////////////////////////////// 
     
    10340    CActiveScheduler::Install(scheduler); 
    10441 
    105     CActiveSchedulerWait *asw = new CActiveSchedulerWait; 
    106     CleanupStack::PushL(asw); 
    107      
    108     MyTask *task = MyTask::NewL(asw); 
    109     task->Start(); 
    110  
    111     asw->Start(); 
    112      
    113     delete task; 
    114      
    115     CleanupStack::Pop(asw); 
    116     delete asw; 
     42    ua_main(); 
    11743     
    11844    CActiveScheduler::Install(NULL); 
  • pjproject/trunk/pjsip-apps/src/symbian_ua/ua.cpp

    r2174 r2379  
    3838// Account 
    3939// 
    40 #define HAS_SIP_ACCOUNT 1       // 0 to disable registration 
     40#define HAS_SIP_ACCOUNT 0       // 1 to enable registration 
    4141#define SIP_DOMAIN      "pjsip.lab" 
    4242#define SIP_USER        "400" 
     
    5454// or STUN (for STUN see other settings below) 
    5555// 
    56 //#define NAMESERVER    NULL 
    57 #define NAMESERVER      "192.168.0.2" 
     56#define NAMESERVER      NULL 
     57//#define NAMESERVER    "192.168.0.2" 
    5858 
    5959// 
     
    250250 
    251251 
     252//#include<e32debug.h> 
     253 
    252254/* Logging callback */ 
    253255static void log_writer(int level, const char *buf, int len) 
     
    260262 
    261263    TPtrC16 aBuf((const TUint16*)buf16, (TInt)len); 
     264    //RDebug::Print(aBuf); 
    262265    console->Write(aBuf); 
    263266     
     
    436439{ 
    437440public: 
    438     ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con); 
     441    ConsoleUI(CConsoleBase *con); 
    439442 
    440443    // Run console UI 
     
    452455     
    453456private: 
    454     CActiveSchedulerWait *asw_; 
    455457    CConsoleBase *con_; 
    456458}; 
    457459 
    458460 
    459 ConsoleUI::ConsoleUI(CActiveSchedulerWait *asw, CConsoleBase *con)  
    460 : CActive(EPriorityStandard), asw_(asw), con_(con) 
     461ConsoleUI::ConsoleUI(CConsoleBase *con)  
     462: CActive(EPriorityStandard), con_(con) 
    461463{ 
    462464    CActiveScheduler::Add(this); 
     
    509511    switch (kc) { 
    510512    case 'w': 
    511             asw_->AsyncStop(); 
     513            CActiveScheduler::Stop(); 
    512514            reschedule = PJ_FALSE; 
    513515            break; 
     
    686688#include <es_sock.h> 
    687689 
     690#if 0 
     691// Force network connection to use the first IAP,  
     692// this is useful for debugging on emulator without GUI.  
     693// Include commdb.lib & apengine.lib in symbian_ua.mmp file 
     694// if this is enabled. 
     695 
     696#include <apdatahandler.h> 
     697 
     698inline void ForceUseFirstIAP()  
     699{ 
     700    TUint32 rank = 1; 
     701    TUint32 bearers; 
     702    TUint32 prompt; 
     703    TUint32 iap; 
     704 
     705    CCommsDatabase* commDb = CCommsDatabase::NewL(EDatabaseTypeIAP); 
     706    CleanupStack::PushL(commDb); 
     707 
     708    CApDataHandler* apDataHandler = CApDataHandler::NewLC(*commDb); 
     709     
     710    TCommDbConnectionDirection direction = ECommDbConnectionDirectionOutgoing; 
     711    apDataHandler->GetPreferredIfDbIapTypeL(rank, direction, bearers, prompt, iap); 
     712    prompt = ECommDbDialogPrefDoNotPrompt; 
     713    apDataHandler->SetPreferredIfDbIapTypeL(rank, direction, bearers, (TCommDbDialogPref)prompt, iap, ETrue); 
     714    CleanupStack::PopAndDestroy(2); // apDataHandler, commDb 
     715} 
     716 
     717static void SelectIAP()  
     718{ 
     719    ForceUseFirstIAP(); 
     720} 
     721 
     722#else 
     723 
     724static void SelectIAP()  
     725{ 
     726} 
     727 
     728#endif 
     729 
     730 
    688731//////////////////////////////////////////////////////////////////////////// 
    689732int ua_main()  
    690733{ 
    691         RSocketServ aSocketServer; 
    692         RConnection aConn; 
    693         TInt err; 
    694         pj_symbianos_params sym_params; 
     734    RSocketServ aSocketServer; 
     735    RConnection aConn; 
     736    TInt err; 
     737    pj_symbianos_params sym_params; 
    695738    pj_status_t status; 
     739 
     740    SelectIAP(); 
    696741     
    697742    // Initialize RSocketServ 
     
    701746    // Open up a connection 
    702747    if ((err=aConn.Open(aSocketServer)) != KErrNone) { 
    703             aSocketServer.Close(); 
    704                 return PJ_STATUS_FROM_OS(err); 
     748        aSocketServer.Close(); 
     749        return PJ_STATUS_FROM_OS(err); 
    705750    } 
    706751     
     
    723768        aConn.Close(); 
    724769        aSocketServer.Close(); 
    725             return status; 
     770        return status; 
    726771    } 
    727772 
    728773    // Run the UI 
    729     CActiveSchedulerWait *asw = new CActiveSchedulerWait; 
    730     ConsoleUI *con = new ConsoleUI(asw, console); 
     774    ConsoleUI *con = new ConsoleUI(console); 
    731775     
    732776    con->Run(); 
    733      
    734777    PrintMenu(); 
    735     asw->Start(); 
     778 
     779    CActiveScheduler::Start(); 
    736780     
    737781    delete con; 
    738     delete asw; 
    739782 
    740783    // Dump memory statistics 
    741784    PJ_LOG(3,(THIS_FILE, "Max heap usage: %u.%03uMB", 
    742                   pjsua_var.cp.peak_used_size / 1000000, 
    743                   (pjsua_var.cp.peak_used_size % 1000000)/1000)); 
     785              pjsua_var.cp.peak_used_size / 1000000, 
     786              (pjsua_var.cp.peak_used_size % 1000000)/1000)); 
    744787     
    745788    // check max stack usage 
     
    747790        pj_thread_t* this_thread = pj_thread_this(); 
    748791        if (!this_thread) 
    749                 return status; 
     792            return status; 
    750793         
    751794        const char* max_stack_file; 
     
    754797         
    755798        PJ_LOG(3,(THIS_FILE, "Max stack usage: %u at %s:%d",  
    756                         pj_thread_get_stack_max_usage(this_thread),  
    757                         max_stack_file, max_stack_line)); 
     799                  pj_thread_get_stack_max_usage(this_thread),  
     800                  max_stack_file, max_stack_line)); 
    758801#endif 
    759802         
     
    763806    // Close connection and socket server 
    764807    aConn.Close(); 
    765         aSocketServer.Close(); 
     808    aSocketServer.Close(); 
    766809         
    767810    return status; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r2315 r2379  
    828828static void busy_sleep(unsigned msec) 
    829829{ 
    830 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 
    831     /* Ideally we shouldn't call pj_thread_sleep() and rather 
    832      * CActiveScheduler::WaitForAnyRequest() here, but that will 
    833      * drag in Symbian header and it doesn't look pretty. 
    834      */ 
    835     pj_thread_sleep(msec); 
    836 #else 
    837830    pj_time_val timeout, now; 
    838831 
     
    846839        pj_gettimeofday(&now); 
    847840    } while (PJ_TIME_VAL_LT(now, timeout)); 
    848 #endif 
    849841} 
    850842 
     
    12041196{ 
    12051197#if defined(PJ_SYMBIAN) && PJ_SYMBIAN != 0 
    1206     /* Ideally we shouldn't call pj_thread_sleep() and rather 
    1207      * CActiveScheduler::WaitForAnyRequest() here, but that will 
    1208      * drag in Symbian header and it doesn't look pretty. 
    1209      */ 
    1210     pj_thread_sleep(msec_timeout); 
    1211     return msec_timeout; 
     1198 
     1199    return pj_symbianos_poll(-1, msec_timeout); 
     1200 
    12121201#else 
    12131202 
     
    12261215 
    12271216    return count; 
     1217     
    12281218#endif 
    12291219} 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c

    r2273 r2379  
    777777        uapres->expires = -1; 
    778778 
    779     st_code = 200; 
     779    st_code = (pjsip_status_code)200; 
    780780    reason = pj_str("OK"); 
    781781    pjsua_msg_data_init(&msg_data); 
Note: See TracChangeset for help on using the changeset viewer.