Ignore:
Timestamp:
Feb 4, 2016 6:11:58 AM (5 years ago)
Author:
ming
Message:

Fixed #1904: Support for Opus codec

File:
1 edited

Legend:

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

    r5234 r5239  
    21102110 
    21112111    /* Open the codec. */ 
     2112 
     2113    /* The clock rate for Opus codec is not static, 
     2114     * it's negotiated in the SDP. 
     2115     */ 
     2116    if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 
     2117        stream->codec_param.info.clock_rate = info->fmt.clock_rate; 
     2118        stream->codec_param.info.channel_cnt = info->fmt.channel_cnt; 
     2119    } 
     2120 
    21122121    status = pjmedia_codec_open(stream->codec, &stream->codec_param); 
    21132122    if (status != PJ_SUCCESS) 
     
    22242233        /* RTP clock rate = 1/2 real clock rate */ 
    22252234        stream->rtp_tx_ts_len_per_pkt >>= 1; 
     2235    } else if (!pj_stricmp2(&info->fmt.encoding_name, "opus")) { 
     2236        unsigned opus_ts_modifier = 48000 / afd->clock_rate; 
     2237        stream->rtp_rx_check_cnt = 0; 
     2238        stream->has_g722_mpeg_bug = PJ_TRUE; 
     2239        stream->rtp_tx_ts_len_per_pkt *= opus_ts_modifier; 
     2240        stream->rtp_rx_ts_len_per_frame *= opus_ts_modifier; 
    22262241    } 
    22272242#endif 
Note: See TracChangeset for help on using the changeset viewer.