Changeset 1777


Ignore:
Timestamp:
Feb 4, 2008 11:37:01 PM (17 years ago)
Author:
nanang
Message:

Ticket #466:
Fixed PCM frame size returned by speex decoder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/jbuf2/pjmedia/src/pjmedia-codec/speex_codec.c

    r1677 r1777  
    769769                                     struct pjmedia_frame *output) 
    770770{ 
    771     struct spx_private *spx; 
    772  
    773     spx = (struct spx_private*) codec->codec_data; 
    774  
    775     PJ_ASSERT_RETURN(output_buf_len >= 320, PJMEDIA_CODEC_EPCMTOOSHORT); 
     771    struct spx_private *spx = (struct spx_private*) codec->codec_data; 
     772    unsigned pcm_size; 
     773 
     774    pcm_size = spx_factory.speex_param[spx->param_id].samples_per_frame << 1; 
     775 
     776    PJ_ASSERT_RETURN(output_buf_len >= pcm_size, PJMEDIA_CODEC_EPCMTOOSHORT); 
    776777 
    777778    if (input->type != PJMEDIA_FRAME_TYPE_AUDIO) { 
    778         pjmedia_zero_samples((pj_int16_t*)output->buf, 160); 
    779         output->size = 320; 
     779        output->size = pcm_size; 
    780780        output->timestamp.u64 = input->timestamp.u64; 
    781781        output->type = PJMEDIA_FRAME_TYPE_AUDIO; 
     782        pj_bzero(output->buf, output->size); 
    782783        return PJ_SUCCESS; 
    783784    } 
     
    790791 
    791792    output->type = PJMEDIA_FRAME_TYPE_AUDIO; 
    792     output->size = 320; 
     793    output->size = pcm_size; 
    793794    output->timestamp.u64 = input->timestamp.u64; 
    794795 
Note: See TracChangeset for help on using the changeset viewer.