Changeset 1843


Ignore:
Timestamp:
Mar 4, 2008 3:31:13 PM (17 years ago)
Author:
bennylp
Message:

Ticket #501: Set master port worker thread priority to highest by default

Location:
pjproject/trunk/pjmedia
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/clock.h

    r974 r1843  
    6363     * #pjmedia_clock_wait() in order to synchronize timing. 
    6464     */ 
    65     PJMEDIA_CLOCK_NO_ASYNC  = 1 
     65    PJMEDIA_CLOCK_NO_ASYNC  = 1, 
     66 
     67    /** 
     68     * Prevent the clock from setting it's thread to highest priority. 
     69     */ 
     70    PJMEDIA_CLOCK_NO_HIGHEST_PRIO = 2 
    6671}; 
    6772 
     
    8792 *                          along with clock_rate, specifies the interval 
    8893 *                          of each clock run (or clock ticks). 
    89  * @param options           By default, the callback will be called  
    90  *                          asynchronously (depending on the clock  
    91  *                          implementation backend, a thread may be  
    92  *                          created). If PJMEDIA_CLOCK_NO_ASYNC is set, 
    93  *                          application must poll the clock with  
    94  *                          #pjmedia_clock_wait() to let the clock runs. 
     94 * @param options           Bitmask of pjmedia_clock_options. 
    9595 * @param cb                Callback to be called for each clock tick. 
    9696 * @param user_data         User data, which will be passed to the callback. 
  • pjproject/trunk/pjmedia/include/pjmedia/master_port.h

    r974 r1843  
    7171 * @param u_port        Upstream port. 
    7272 * @param d_port        Downstream port. 
    73  * @param options       Options flags, must be zero for now. 
     73 * @param options       Options flags, from bitmask combinations from 
     74 *                      pjmedia_clock_options. 
    7475 * @param p_m           Pointer to receive the master port instance. 
    7576 * 
  • pjproject/trunk/pjmedia/src/pjmedia/clock_thread.c

    r1747 r1843  
    216216    pjmedia_clock *clock = (pjmedia_clock*) arg; 
    217217 
     218    /* Set thread priority to maximum unless not wanted. */ 
     219    if ((clock->options & PJMEDIA_CLOCK_NO_HIGHEST_PRIO) == 0) { 
     220        int max = pj_thread_get_prio_max(pj_thread_this()); 
     221        if (max > 0) 
     222            pj_thread_set_prio(pj_thread_this(), max); 
     223    } 
     224 
    218225    /* Get the first tick */ 
    219226    pj_get_timestamp(&clock->next_tick); 
  • pjproject/trunk/pjmedia/src/pjmedia/master_port.c

    r1266 r1843  
    103103 
    104104    /* Create media clock */ 
    105     status = pjmedia_clock_create(pool, clock_rate, samples_per_frame, 0, 
    106                                   &clock_callback, m, &m->clock); 
     105    status = pjmedia_clock_create(pool, clock_rate, samples_per_frame,  
     106                                  options, &clock_callback, m, &m->clock); 
    107107    if (status != PJ_SUCCESS) { 
    108108        pj_lock_destroy(m->lock); 
Note: See TracChangeset for help on using the changeset viewer.