Changeset 3955


Ignore:
Timestamp:
Feb 20, 2012 3:30:54 AM (12 years ago)
Author:
nanang
Message:

Re #1244: Added bitrate adjustment for video encoder based on remote SDP "b=TIAS" line in media level.

File:
1 edited

Legend:

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

    r3905 r3955  
    18921892                                                     si->codec_param); 
    18931893 
     1894    /* Adjust encoding bitrate, if higher than remote preference. The remote 
     1895     * bitrate preference is read from SDP "b=TIAS" line in media level. 
     1896     */ 
     1897    if ((si->dir & PJMEDIA_DIR_ENCODING) && rem_m->bandw_count) { 
     1898        unsigned i, bandw = 0; 
     1899 
     1900        for (i = 0; i < rem_m->bandw_count; ++i) { 
     1901            const pj_str_t STR_BANDW_MODIFIER_TIAS = { "TIAS", 4 }; 
     1902            if (!pj_stricmp(&rem_m->bandw[i]->modifier,  
     1903                &STR_BANDW_MODIFIER_TIAS)) 
     1904            { 
     1905                bandw = rem_m->bandw[i]->value; 
     1906                break; 
     1907            } 
     1908        } 
     1909 
     1910        if (bandw) { 
     1911            pjmedia_video_format_detail *enc_vfd; 
     1912            enc_vfd = pjmedia_format_get_video_format_detail( 
     1913                                        &si->codec_param->enc_fmt, PJ_TRUE); 
     1914            if (!enc_vfd->avg_bps || enc_vfd->avg_bps > bandw) 
     1915                enc_vfd->avg_bps = bandw * 3 / 4; 
     1916            if (!enc_vfd->max_bps || enc_vfd->max_bps > bandw) 
     1917                enc_vfd->max_bps = bandw; 
     1918        } 
     1919    } 
     1920 
    18941921    /* Get remote fmtp for our encoder. */ 
    18951922    pjmedia_stream_info_parse_fmtp(pool, rem_m, si->tx_pt, 
Note: See TracChangeset for help on using the changeset viewer.