Changeset 4001 for pjproject/trunk


Ignore:
Timestamp:
Mar 30, 2012 7:53:36 AM (12 years ago)
Author:
bennylp
Message:

Re #1474: merged r3879:3885

Location:
pjproject/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/g7221.c

    r3911 r4001  
    760760{ 
    761761    codec_private_t *codec_data = (codec_private_t*) codec->codec_data; 
    762     const Word16 *pcm_input; 
    763     Word16 mlt_coefs[MAX_SAMPLES_PER_FRAME]; 
    764     Word16 mag_shift; 
     762    unsigned nsamples, processed; 
    765763 
    766764    /* Check frame in & out size */ 
    767     PJ_ASSERT_RETURN((pj_uint16_t)input->size ==  
    768                      (codec_data->samples_per_frame<<1), 
    769                      PJMEDIA_CODEC_EPCMTOOSHORT); 
    770     PJ_ASSERT_RETURN(output_buf_len >= codec_data->frame_size, 
     765    nsamples = input->size >> 1; 
     766    PJ_ASSERT_RETURN(nsamples % codec_data->samples_per_frame == 0,  
     767                     PJMEDIA_CODEC_EPCMFRMINLEN); 
     768    PJ_ASSERT_RETURN(output_buf_len >= codec_data->frame_size * nsamples / 
     769                     codec_data->samples_per_frame, 
    771770                     PJMEDIA_CODEC_EFRMTOOSHORT); 
    772771 
     
    800799    } 
    801800 
    802     /* Encoder adjust the input signal level */ 
    803     if (codec_data->pcm_shift) { 
    804         unsigned i; 
    805         pcm_input = (const Word16*)input->buf; 
    806         for (i=0; i<codec_data->samples_per_frame; ++i) { 
    807             codec_data->enc_frame[i] =  
    808                 (pj_int16_t)(pcm_input[i] >> codec_data->pcm_shift); 
     801    processed = 0; 
     802    output->size = 0; 
     803    while (processed < nsamples) { 
     804        Word16 mlt_coefs[MAX_SAMPLES_PER_FRAME]; 
     805        Word16 mag_shift; 
     806        const Word16 *pcm_input; 
     807        pj_int8_t *out_bits; 
     808         
     809        pcm_input = (const Word16*)input->buf + processed; 
     810        out_bits = (pj_int8_t*)output->buf + output->size; 
     811 
     812        /* Encoder adjust the input signal level */ 
     813        if (codec_data->pcm_shift) { 
     814            unsigned i; 
     815            for (i=0; i<codec_data->samples_per_frame; ++i) { 
     816                codec_data->enc_frame[i] =  
     817                        (Word16)(pcm_input[i] >> codec_data->pcm_shift); 
     818            } 
     819            pcm_input = codec_data->enc_frame; 
    809820        } 
    810         pcm_input = codec_data->enc_frame; 
    811     } else { 
    812         pcm_input = (const Word16*)input->buf; 
    813     } 
    814  
    815     /* Convert input samples to rmlt coefs */ 
    816     mag_shift = samples_to_rmlt_coefs(pcm_input, 
    817                                       codec_data->enc_old_frame,  
    818                                       mlt_coefs,  
    819                                       codec_data->samples_per_frame); 
    820  
    821     /* Encode the mlt coefs. Note that encoder output stream is 16 bit array, 
    822      * so we need to take care about endianness. 
    823      */ 
    824     encoder(codec_data->frame_size_bits, 
    825             codec_data->number_of_regions, 
    826             mlt_coefs, 
    827             mag_shift, 
    828             output->buf); 
    829  
    830     /* Encoder output are in native host byte order, while ITU says 
    831      * it must be in network byte order (MSB first). 
    832      */ 
    833     swap_bytes((pj_uint16_t*)output->buf, codec_data->frame_size/2); 
     821 
     822        /* Convert input samples to rmlt coefs */ 
     823        mag_shift = samples_to_rmlt_coefs(pcm_input, 
     824                                          codec_data->enc_old_frame,  
     825                                          mlt_coefs,  
     826                                          codec_data->samples_per_frame); 
     827 
     828        /* Encode the mlt coefs. Note that encoder output stream is 
     829         * 16 bit array, so we need to take care about endianness. 
     830         */ 
     831        encoder(codec_data->frame_size_bits, 
     832                codec_data->number_of_regions, 
     833                mlt_coefs, 
     834                mag_shift, 
     835                (Word16*)out_bits); 
     836 
     837        /* Encoder output are in native host byte order, while ITU says 
     838         * it must be in network byte order (MSB first). 
     839         */ 
     840        swap_bytes((pj_uint16_t*)out_bits, codec_data->frame_size/2); 
     841 
     842        processed += codec_data->samples_per_frame; 
     843        output->size += codec_data->frame_size; 
     844    } 
    834845 
    835846    output->type = PJMEDIA_FRAME_TYPE_AUDIO; 
    836     output->size = codec_data->frame_size; 
    837847    output->timestamp = input->timestamp; 
    838848 
  • pjproject/trunk/pjsip/src/pjsip/sip_transaction.c

    r3999 r4001  
    32403240{ 
    32413241    pj_assert(tsx->state == PJSIP_TSX_STATE_TERMINATED); 
    3242     pj_assert(event->type == PJSIP_EVENT_TIMER); 
     3242 
     3243    /* Ignore events other than timer. This used to be an assertion but 
     3244     * events may genuinely arrive at this state. 
     3245     */ 
     3246    if (event->type != PJSIP_EVENT_TIMER) { 
     3247        return PJ_EIGNORED; 
     3248    } 
    32433249 
    32443250    /* Destroy this transaction */ 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r3938 r4001  
    13611361    int i;  /* Must be signed */ 
    13621362 
     1363    if (pjsua_var.endpt) { 
     1364        PJ_LOG(4,(THIS_FILE, "Shutting down, flags=%d...", flags)); 
     1365    } 
     1366 
    13631367    if (pjsua_var.state > PJSUA_STATE_NULL && 
    13641368        pjsua_var.state < PJSUA_STATE_CLOSING) 
     
    13731377    for (i=0; i<(int)pjsua_var.ua_cfg.thread_cnt; ++i) { 
    13741378        if (pjsua_var.thread[i]) { 
    1375             pj_thread_join(pjsua_var.thread[i]); 
     1379            pj_status_t status; 
     1380            status = pj_thread_join(pjsua_var.thread[i]); 
     1381            if (status != PJ_SUCCESS) { 
     1382                PJ_PERROR(4,(THIS_FILE, status, "Error joining worker thread")); 
     1383                pj_thread_sleep(1000); 
     1384            } 
    13761385            pj_thread_destroy(pjsua_var.thread[i]); 
    13771386            pjsua_var.thread[i] = NULL; 
     
    13811390    if (pjsua_var.endpt) { 
    13821391        unsigned max_wait; 
    1383  
    1384         PJ_LOG(4,(THIS_FILE, "Shutting down, flags=%d...", flags)); 
    13851392 
    13861393        pj_log_push_indent(); 
Note: See TracChangeset for help on using the changeset viewer.