Changeset 1825 for pjproject/trunk


Ignore:
Timestamp:
Feb 28, 2008 2:16:43 PM (17 years ago)
Author:
bennylp
Message:

Ticket #496: Crash on sound port when only player is opened and delaybuf enabled

File:
1 edited

Legend:

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

    r1715 r1825  
    100100 
    101101#if PJMEDIA_SOUND_USE_DELAYBUF 
    102     status = pjmedia_delay_buf_get(snd_port->delay_buf, (pj_int16_t*)output); 
    103     if (status != PJ_SUCCESS) { 
    104         pj_bzero(output, size); 
    105     } 
    106  
    107     pjmedia_port_put_frame(port, &frame); 
     102    if (snd_port->delay_buf) { 
     103        status = pjmedia_delay_buf_get(snd_port->delay_buf, (pj_int16_t*)output); 
     104        if (status != PJ_SUCCESS) { 
     105            pj_bzero(output, size); 
     106        } 
     107 
     108        frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
     109        pjmedia_port_put_frame(port, &frame); 
     110    } 
    108111#endif 
    109112 
     
    201204 
    202205#if PJMEDIA_SOUND_USE_DELAYBUF 
    203     PJ_UNUSED_ARG(size); 
    204     PJ_UNUSED_ARG(timestamp); 
    205     PJ_UNUSED_ARG(frame); 
    206     pjmedia_delay_buf_put(snd_port->delay_buf, (pj_int16_t*)input); 
     206    if (snd_port->delay_buf) { 
     207        pjmedia_delay_buf_put(snd_port->delay_buf, (pj_int16_t*)input); 
     208    } else { 
     209        frame.buf = (void*)input; 
     210        frame.size = size; 
     211        frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
     212        frame.timestamp.u32.lo = timestamp; 
     213 
     214        pjmedia_port_put_frame(port, &frame); 
     215    } 
    207216#else 
    208217    frame.buf = (void*)input; 
Note: See TracChangeset for help on using the changeset viewer.