- Timestamp:
- Jun 30, 2016 3:36:39 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/opus.c
r5368 r5371 398 398 } 399 399 opus_cfg.bit_rate = cfg->bit_rate; 400 param->info.avg_bps = opus_cfg.bit_rate; 400 401 401 402 /* Set expected packet loss */ … … 462 463 attr->info.clock_rate = opus_cfg.sample_rate; 463 464 attr->info.channel_cnt = opus_cfg.channel_cnt; 464 attr->info.avg_bps = (opus_cfg.bit_rate > 0) ? 465 opus_cfg.bit_rate : 466 opus_cfg.sample_rate; // Estimate 465 attr->info.avg_bps = opus_cfg.bit_rate; 467 466 attr->info.max_bps = opus_cfg.bit_rate * 2; 468 467 attr->info.frm_ptime = 20; … … 588 587 struct opus_data *opus_data = (struct opus_data *)codec->codec_data; 589 588 int idx, err; 589 pj_bool_t auto_bit_rate = PJ_TRUE; 590 590 591 591 PJ_ASSERT_RETURN(codec && attr && opus_data, PJ_EINVAL); … … 630 630 if (idx >= 0) { 631 631 unsigned rate; 632 auto_bit_rate = PJ_FALSE; 632 633 rate = (unsigned)pj_strtoul(&attr->setting.enc_fmtp.param[idx].val); 633 634 if (rate < attr->info.avg_bps) … … 684 685 opus_encoder_ctl(opus_data->enc, OPUS_SET_SIGNAL(OPUS_SIGNAL_VOICE)); 685 686 /* Set bitrate */ 686 opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(attr->info.avg_bps)); 687 opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(auto_bit_rate? 688 OPUS_AUTO: 689 attr->info.avg_bps)); 687 690 /* Set VAD */ 688 691 opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0)); … … 767 770 /* Set bitrate */ 768 771 opus_data->cfg.bit_rate = attr->info.avg_bps; 769 opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(attr->info.avg_bps)); 772 opus_encoder_ctl(opus_data->enc, OPUS_SET_BITRATE(attr->info.avg_bps? 773 attr->info.avg_bps: 774 OPUS_AUTO)); 770 775 /* Set VAD */ 771 776 opus_encoder_ctl(opus_data->enc, OPUS_SET_DTX(attr->setting.vad ? 1 : 0));
Note: See TracChangeset
for help on using the changeset viewer.