Changeset 2984 for pjproject/trunk


Ignore:
Timestamp:
Nov 4, 2009 4:24:33 AM (15 years ago)
Author:
bennylp
Message:

Fixed ticket #975: Symbian timer heap implementation unable to schedule duration more than 2100 seconds (thanks Nir Elkayam for the report)

File:
1 edited

Legend:

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

    r2394 r2984  
    2929#define DEFAULT_MAX_TIMED_OUT_PER_POLL  (64) 
    3030 
     31// Maximum number of miliseconds that RTimer.At() supports 
     32#define MAX_RTIMER_INTERVAL             2147 
     33 
    3134 
    3235/** 
     
    6669    pj_timer_entry  *entry_; 
    6770    RTimer           rtimer_; 
     71    pj_uint32_t      interval_left_; 
    6872     
    6973    CPjTimerEntry(pj_timer_heap_t *timer_heap, pj_timer_entry *entry); 
    7074    void ConstructL(const pj_time_val *delay); 
     75    void Schedule(); 
    7176}; 
    7277 
     
    7479CPjTimerEntry::CPjTimerEntry(pj_timer_heap_t *timer_heap, 
    7580                             pj_timer_entry *entry) 
    76 : CActive(PJ_SYMBIAN_TIMER_PRIORITY), timer_heap_(timer_heap), entry_(entry) 
     81: CActive(PJ_SYMBIAN_TIMER_PRIORITY), timer_heap_(timer_heap), entry_(entry), 
     82  interval_left_(0) 
    7783{ 
    7884} 
     
    8490} 
    8591 
     92void CPjTimerEntry::Schedule() 
     93{ 
     94    pj_int32_t interval; 
     95     
     96    if (interval_left_ > MAX_RTIMER_INTERVAL) { 
     97        interval = MAX_RTIMER_INTERVAL; 
     98    } else { 
     99        interval = interval_left_; 
     100    } 
     101     
     102    interval_left_ -= interval; 
     103    rtimer_.After(iStatus, interval * 1000); 
     104    SetActive(); 
     105} 
     106 
    86107void CPjTimerEntry::ConstructL(const pj_time_val *delay)  
    87108{ 
     
    89110    CActiveScheduler::Add(this); 
    90111     
    91     pj_int32_t interval = PJ_TIME_VAL_MSEC(*delay) * 1000; 
    92     if (interval < 0) { 
    93         interval = 0; 
    94     } 
    95     rtimer_.After(iStatus, interval); 
    96     SetActive(); 
     112    interval_left_ = PJ_TIME_VAL_MSEC(*delay); 
     113    Schedule(); 
    97114} 
    98115 
     
    111128void CPjTimerEntry::RunL()  
    112129{ 
     130    if (interval_left_ > 0) { 
     131        Schedule(); 
     132        return; 
     133    } 
     134     
    113135    --timer_heap_->cur_size; 
    114136    entry_->_timer_id = NULL; 
Note: See TracChangeset for help on using the changeset viewer.