Changeset 1834 for pjproject/trunk


Ignore:
Timestamp:
Feb 29, 2008 6:00:34 PM (17 years ago)
Author:
bennylp
Message:

Added checking in delaybuf for buffer empty before calling shrink_buffer()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/delaybuf.c

    r1833 r1834  
    198198    pj_status_t status; 
    199199 
    200     pj_assert(b && erase_cnt); 
     200    pj_assert(b && erase_cnt && b->buf_cnt); 
    201201 
    202202    if (b->get_pos < b->put_pos) { 
     
    273273    /* For now, only support shrinking */ 
    274274    pj_assert(old_max_cnt > new_max_cnt); 
     275 
     276    /* Buffer empty, only need to reset pointers then set new max directly */ 
     277    if (b->buf_cnt == 0) { 
     278        b->put_pos = b->get_pos = 0; 
     279        b->max_cnt = new_max_cnt; 
     280        return; 
     281    } 
    275282 
    276283    shrink_buffer(b, old_max_cnt - new_max_cnt); 
Note: See TracChangeset for help on using the changeset viewer.