Ignore:
Timestamp:
Mar 29, 2012 10:54:01 AM (12 years ago)
Author:
nanang
Message:

Fix #1473: Fixed H263 encoder setting negotiation in pjmedia_vid_codec_h263_apply_fmtp() to be based on pjmedia_vid_codec_param.enc_fmt.det.vid.fps (it was based on local H263 SDP fmtp).

File:
1 edited

Legend:

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

    r3715 r3995  
    150150 
    151151 
     152static unsigned fps_to_mpi(const pjmedia_ratio *fps)  
     153{ 
     154    unsigned mpi; 
     155 
     156    /* Original formula = (fps->denum * 30000) / (fps->num * 1001) */ 
     157    mpi = (fps->denum*30000 + fps->num*1001/2) / (fps->num*1001); 
     158     
     159    /* Normalize, should be in the range of 1-32 */ 
     160    if (mpi > 32) mpi = 32; 
     161    if (mpi < 1) mpi = 1; 
     162 
     163    return mpi; 
     164}; 
     165 
    152166PJ_DEF(pj_status_t) pjmedia_vid_codec_h263_apply_fmtp( 
    153167                                pjmedia_vid_codec_param *param) 
     
    160174        pj_status_t status; 
    161175 
     176        vfd = pjmedia_format_get_video_format_detail(&param->enc_fmt, 
     177                                                     PJ_TRUE); 
     178 
    162179        /* Get local param */ 
    163         status = pjmedia_vid_codec_parse_h263_fmtp(&param->dec_fmtp, 
    164                                                    &fmtp_loc); 
    165         if (status != PJ_SUCCESS) 
    166             return status; 
     180        // Local param should be fetched from "param->enc_fmt" instead of 
     181        // "param->dec_fmtp". 
     182        //status = pjmedia_vid_codec_parse_h263_fmtp(&param->dec_fmtp, 
     183        //                                         &fmtp_loc); 
     184        //if (status != PJ_SUCCESS) 
     185        //    return status; 
     186        fmtp_loc.mpi_cnt = 1; 
     187        fmtp_loc.mpi[0].size = vfd->size; 
     188        fmtp_loc.mpi[0].val  = fps_to_mpi(&vfd->fps); 
    167189 
    168190        /* Get remote param */ 
     
    178200            size.h = 144; 
    179201            mpi    = 1; 
    180         } else if (fmtp_loc.mpi_cnt == 0) { 
    181             /* Local MPI setting not set, just use remote preference. */ 
    182             size = fmtp_rem.mpi[0].size; 
    183             mpi  = fmtp_rem.mpi[0].val; 
     202        //} else if (fmtp_loc.mpi_cnt == 0) { 
     203        //    /* Local MPI setting not set, just use remote preference. */ 
     204        //    size = fmtp_rem.mpi[0].size; 
     205        //    mpi  = fmtp_rem.mpi[0].val; 
    184206        } else { 
    185207            /* Both have preferences, let's try to match them */ 
     
    220242 
    221243        /* Apply the negotiation result */ 
    222         vfd = pjmedia_format_get_video_format_detail(&param->enc_fmt, 
    223                                                      PJ_TRUE); 
    224244        vfd->size = size; 
    225245        vfd->fps.num = 30000; 
Note: See TracChangeset for help on using the changeset viewer.