Changeset 5799 for pjproject/trunk/pjmedia/src/pjmedia-codec/opus.c
- Timestamp:
- May 30, 2018 7:41:23 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-codec/opus.c
r5734 r5799 374 374 375 375 TRACE_((THIS_FILE, "%s:%d: - TRACE", __FUNCTION__, __LINE__)); 376 PJ_ASSERT_RETURN(cfg , PJ_EINVAL);376 PJ_ASSERT_RETURN(cfg && param, PJ_EINVAL); 377 377 378 378 codec_mgr = pjmedia_endpt_get_codec_mgr(opus_codec_factory.endpt); … … 390 390 return PJ_EINVAL; 391 391 } 392 393 status = pjmedia_codec_mgr_get_default_param(codec_mgr, info[0], param); 394 if (status != PJ_SUCCESS) 395 return status; 396 392 397 param->info.clock_rate = opus_cfg.sample_rate = cfg->sample_rate; 393 398 param->info.max_bps = opus_cfg.sample_rate * 2; 394 param->info.frm_ptime = opus_cfg.frm_ptime = cfg->frm_ptime; 399 opus_cfg.frm_ptime = cfg->frm_ptime; 400 param->info.frm_ptime = (pj_uint16_t)cfg->frm_ptime; 395 401 396 402 /* Set channel count */ … … 474 480 attr->info.avg_bps = opus_cfg.bit_rate; 475 481 attr->info.max_bps = opus_cfg.sample_rate * 2; 476 attr->info.frm_ptime = opus_cfg.frm_ptime;482 attr->info.frm_ptime = (pj_uint16_t)opus_cfg.frm_ptime; 477 483 attr->setting.frm_per_pkt = 1; 478 484 attr->info.pcm_bits_per_sample = 16; 479 485 attr->setting.vad = OPUS_DEFAULT_VAD; 480 486 attr->setting.plc = OPUS_DEFAULT_PLC; 487 488 /* Set max RX frame size to 1275 (max Opus frame size) to anticipate 489 * possible ptime change on the fly. 490 */ 491 attr->info.max_rx_frame_size = 1275; 481 492 482 493 generate_fmtp(attr); … … 808 819 int i, num_frames; 809 820 int size, out_pos; 810 unsigned samples_per_frame ;821 unsigned samples_per_frame = 0; 811 822 #if (USE_INCOMING_WORSE_SETTINGS) 812 823 int bw; … … 1002 1013 opus_data->cfg.channel_cnt); 1003 1014 if (inframe->type != PJMEDIA_FRAME_TYPE_AUDIO || fec) { 1004 frm_size = PJ_MIN( frm_size,1015 frm_size = PJ_MIN((unsigned)frm_size, 1005 1016 opus_data->cfg.sample_rate * 1006 1017 opus_data->dec_ptime / 1000); … … 1063 1074 if (opus_data->dec_frame_index == -1) { 1064 1075 /* Recover the first packet? Don't think so, fill it with zeroes. */ 1065 pj_uint16_tsamples_per_frame;1076 unsigned samples_per_frame; 1066 1077 samples_per_frame = opus_data->cfg.sample_rate * opus_data->dec_ptime/ 1067 1078 1000; … … 1078 1089 opus_data->cfg.channel_cnt); 1079 1090 if (inframe->type != PJMEDIA_FRAME_TYPE_AUDIO) { 1080 frm_size = PJ_MIN( frm_size, opus_data->cfg.sample_rate *1091 frm_size = PJ_MIN((unsigned)frm_size, opus_data->cfg.sample_rate * 1081 1092 opus_data->dec_ptime/1000); 1082 1093 }
Note: See TracChangeset
for help on using the changeset viewer.