Changeset 1667 for pjproject


Ignore:
Timestamp:
Jan 7, 2008 6:33:25 PM (17 years ago)
Author:
bennylp
Message:

Ticket #439: don't call encode() if input is FRAME_TYPE_NONE

File:
1 edited

Legend:

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

    r1621 r1667  
    141141                                   'A', 'B', 'C', 'D'}; 
    142142 
    143 /* Zero PCM frame */ 
    144 #define ZERO_PCM_MAX_SIZE   1920    /* 40ms worth of PCM @ 48KHz */ 
    145 static pj_int16_t zero_frame[ZERO_PCM_MAX_SIZE]; 
    146  
    147  
    148143/* 
    149144 * Print error. 
     
    574569        } 
    575570 
    576     } else if (frame->type != PJMEDIA_FRAME_TYPE_NONE) { 
     571        /* No need to encode if this is a zero frame. 
     572         * See http://www.pjsip.org/trac/ticket/439  
     573         */ 
     574    } else if (frame->type != PJMEDIA_FRAME_TYPE_NONE && 
     575               frame->buf != NULL)  
     576    { 
    577577        unsigned ts, codec_samples_per_frame; 
    578578 
     
    730730     *  silence frame. 
    731731     */ 
    732     if (frame->type == PJMEDIA_FRAME_TYPE_NONE && 
    733         samples_per_frame <= ZERO_PCM_MAX_SIZE)  
    734     { 
     732    if (frame->type == PJMEDIA_FRAME_TYPE_NONE) { 
    735733        pj_memcpy(&tmp_zero_frame, frame, sizeof(pjmedia_frame)); 
    736734        frame = &tmp_zero_frame; 
    737735 
    738         tmp_zero_frame.buf = zero_frame; 
     736        tmp_zero_frame.buf = NULL; 
    739737        tmp_zero_frame.size = samples_per_frame * 2; 
    740738        tmp_zero_frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
     
    756754        frame = &tmp_in_frame; 
    757755 
    758         tmp_in_frame.buf = zero_frame; 
     756        tmp_in_frame.buf = NULL; 
    759757        tmp_in_frame.size = samples_per_frame * 2; 
    760758        tmp_in_frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
Note: See TracChangeset for help on using the changeset viewer.