Ignore:
Timestamp:
Apr 23, 2013 7:56:12 AM (11 years ago)
Author:
bennylp
Message:

Re #1656: integration of Gurtej's patch (email re: PJSIP BB10 Performance and sound dev fixes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-audiodev/bb10_dev.c

    r4480 r4490  
    438438    pj_timestamp tstamp; 
    439439    int result = 0; 
     440    int policy; 
     441    struct sched_param param; 
     442 
     443    TRACE_((THIS_FILE, "pb_thread_func: size = %d ", size)); 
     444 
     445    pthread_getschedparam(pthread_self(), &policy, &param); 
     446    param.sched_priority = 18; 
     447    pthread_setschedparam (pthread_self(), policy, &param); 
    440448 
    441449    pj_bzero (buf, size); 
    442450    tstamp.u64 = 0; 
    443  
    444     TRACE_((THIS_FILE, "pb_thread_func: size = %d ", size)); 
    445451 
    446452    /* Do the final initialization now the thread has started. */ 
     
    527533    pj_timestamp tstamp; 
    528534    int result; 
     535    int policy; 
    529536    struct sched_param param; 
    530     pthread_t *thid; 
    531537 
    532538    TRACE_((THIS_FILE, "ca_thread_func: size = %d ", size)); 
    533539 
    534     thid = (pthread_t*) pj_thread_get_os_handle (pj_thread_this()); 
    535     param.sched_priority = sched_get_priority_max (SCHED_RR); 
    536  
    537     result = pthread_setschedparam (*thid, SCHED_RR, &param); 
    538     if (result) { 
    539         if (result == EPERM) { 
    540             PJ_LOG (4,(THIS_FILE, "Unable to increase thread priority, " 
    541                                   "root access needed.")); 
    542         } else { 
    543             PJ_LOG (4,(THIS_FILE, "Unable to increase thread priority, " 
    544                                   "error: %d", result)); 
    545         } 
    546     } 
     540    pthread_getschedparam(pthread_self(), &policy, &param); 
     541    param.sched_priority = 18; 
     542    pthread_setschedparam (pthread_self(), policy, &param); 
    547543 
    548544    pj_bzero (buf, size); 
     
    561557        pjmedia_frame frame; 
    562558 
    563         pj_bzero (buf, size); 
     559        //pj_bzero (buf, size); 
    564560 
    565561        /* read the input device */ 
     
    752748    pp.mode = SND_PCM_MODE_BLOCK; 
    753749    pp.channel = SND_PCM_CHANNEL_PLAYBACK; 
    754     pp.start_mode = SND_PCM_START_DATA; 
     750    pp.start_mode = SND_PCM_START_FULL; 
    755751    pp.stop_mode = SND_PCM_STOP_ROLLOVER; 
    756752    pp.buf.block.frag_size = param->samples_per_frame * param->bits_per_sample / 8; 
    757     /* RIM recommends maximum of 3 */ 
    758     pp.buf.block.frags_max = 3; 
     753    /* RIM recommends maximum of 5 */ 
     754    pp.buf.block.frags_max = 5; 
    759755    pp.buf.block.frags_min = 1; 
    760756    pp.format.interleave = 1; 
     
    861857    pp.mode = SND_PCM_MODE_BLOCK; 
    862858    pp.channel = SND_PCM_CHANNEL_CAPTURE; 
    863     pp.start_mode = SND_PCM_START_DATA; 
     859    pp.start_mode = SND_PCM_START_FULL; 
    864860    /* Auto-recover from errors */ 
    865861    pp.stop_mode = SND_PCM_STOP_ROLLOVER; 
    866862    pp.buf.block.frag_size = param->samples_per_frame * param->bits_per_sample / 8; 
    867863    /* From January 2013 gold OS release. RIM recommend these for capture */ 
    868     pp.buf.block.frags_max = 1; 
     864    pp.buf.block.frags_max = -1; 
    869865    pp.buf.block.frags_min = 1; 
    870866    pp.format.interleave = 1; 
Note: See TracChangeset for help on using the changeset viewer.