Changeset 3136 for pjproject


Ignore:
Timestamp:
Apr 12, 2010 10:42:23 AM (15 years ago)
Author:
nanang
Message:

Ticket #1055: Fixed possibility of APS server panic in codec detection on few devices, e.g:N95, by adding short delay before closing APS session.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/symb_aps_dev.cpp

    r3135 r3136  
    182182} 
    183183 
     184/* 
     185 * Utility: wait for specified time. 
     186 */ 
     187static void snd_wait(unsigned ms)  
     188{ 
     189    TTime start, now; 
     190     
     191    start.UniversalTime(); 
     192    do { 
     193        pj_symbianos_poll(-1, ms); 
     194        now.UniversalTime(); 
     195    } while (now.MicroSecondsFrom(start) < ms * 1000); 
     196} 
     197 
    184198typedef void(*PjAudioCallback)(TAPSCommBuffer &buf, void *user_data); 
    185199 
     
    652666 
    653667    if (session_opened) { 
    654         TTime start, now; 
    655668        enum { APS_CLOSE_WAIT_TIME = 200 }; /* in msecs */ 
    656669         
     
    658671        // APS server panic KERN-EXEC 0, so let's wait for sometime before 
    659672        // closing the client session. 
    660         start.UniversalTime(); 
    661         do { 
    662             pj_symbianos_poll(-1, APS_CLOSE_WAIT_TIME); 
    663             now.UniversalTime(); 
    664         } while (now.MicroSecondsFrom(start) < APS_CLOSE_WAIT_TIME * 1000); 
     673        snd_wait(APS_CLOSE_WAIT_TIME); 
    665674 
    666675        iSession.Close(); 
     
    13571366            if (err == KErrNone) 
    13581367                err = iSession.InitializeRecorder(iRecSettings); 
     1368             
     1369            // On some devices, immediate closing causes APS Server panic, 
     1370            // e.g: N95, so let's just wait for some time before closing. 
     1371            enum { APS_CLOSE_WAIT_TIME = 200 }; /* in msecs */ 
     1372            snd_wait(APS_CLOSE_WAIT_TIME); 
     1373             
    13591374            iSession.Close(); 
    13601375 
     
    13661381                 * let's wait before retrying. 
    13671382                 */ 
    1368                 enum { RETRY_WAIT = 3000 }; /* in msecs */ 
    1369                 TTime start, now; 
    1370                  
    1371                 start.UniversalTime(); 
    1372                 do { 
    1373                     pj_symbianos_poll(-1, RETRY_WAIT); 
    1374                     now.UniversalTime(); 
    1375                 } while (now.MicroSecondsFrom(start) < RETRY_WAIT * 1000); 
     1383                enum { RETRY_WAIT_TIME = 3000 }; /* in msecs */ 
     1384                snd_wait(RETRY_WAIT_TIME); 
    13761385            } else { 
    13771386                /* Seems that this format is not supported */ 
Note: See TracChangeset for help on using the changeset viewer.